[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/cape e2fd7c1cc6 038/146: Minor refactoring
From: |
ELPA Syncer |
Subject: |
[elpa] externals/cape e2fd7c1cc6 038/146: Minor refactoring |
Date: |
Sun, 9 Jan 2022 20:57:40 -0500 (EST) |
branch: externals/cape
commit e2fd7c1cc6b88cd0532a27c3cf5166a6160d9658
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>
Minor refactoring
---
cape.el | 35 +++++++++++++++++++----------------
1 file changed, 19 insertions(+), 16 deletions(-)
diff --git a/cape.el b/cape.el
index a27bbad11d..62ff59c5c5 100644
--- a/cape.el
+++ b/cape.el
@@ -386,13 +386,13 @@
BEG and END are the input bounds.
CMP is the input comparison function, see `cape--input-changed-p'.
FUN is the function which computes the candidates."
- (let ((input nil)
+ (let ((input 'init)
(beg (copy-marker beg))
(end (copy-marker end t))
- (table 'init))
+ (table nil))
(lambda (str pred action)
(let ((new-input (buffer-substring-no-properties beg end)))
- (when (or (eq table 'init) (cape--input-changed-p input new-input cmp))
+ (when (or (eq input 'init) (cape--input-changed-p input new-input cmp))
(setq table (funcall fun new-input) input new-input)))
(complete-with-action action table str pred))))
@@ -634,18 +634,18 @@ See `cape--input-changed-p' for the CMP argument."
(lambda ()
(pcase (funcall capf)
(`(,beg ,end ,table . ,plist)
- (let* ((start (copy-marker beg))
- (input (buffer-substring-no-properties start (point))))
- `(,beg ,end
- ,(lambda (str pred action)
- (let ((new-input (buffer-substring-no-properties start
(point))))
- (when (and (not (string-match-p "\\s-" new-input))
- (cape--input-changed-p input new-input cmp))
+ `(,beg ,end
+ ,(let* ((beg (copy-marker beg))
+ (end (copy-marker end t))
+ (input (buffer-substring-no-properties beg end)))
+ (lambda (str pred action)
+ (let ((new-input (buffer-substring-no-properties beg end)))
+ (when (cape--input-changed-p input new-input cmp)
(pcase (funcall capf)
(`(,_beg ,_end ,new-table . ,_plist)
(setq table new-table input new-input)))))
- (complete-with-action action table str pred))
- ,@plist))))))
+ (complete-with-action action table str pred)))
+ ,@plist)))))
(defun cape--input-changed-p (old-input new-input cmp)
"Return non-nil if the NEW-INPUT has changed in comparison to OLD-INPUT.
@@ -653,10 +653,13 @@ The CMP argument determines how the new input is compared
to the old input.
- prefix/nil: The old input is not a prefix of the new input.
- equal: The old input is not equal to the new input.
- substring: The old input is not a substring of the new input."
- (not (pcase-exhaustive cmp
- ((or 'prefix 'nil) (string-prefix-p old-input new-input))
- ('equal (equal old-input new-input))
- ('substring (string-match-p (regexp-quote old-input) new-input)))))
+ ;; Treat input as not changed if it contains space to allow
+ ;; Orderless completion style filtering.
+ (not (or (string-match-p "\\s-" new-input)
+ (pcase-exhaustive cmp
+ ((or 'prefix 'nil) (string-prefix-p old-input new-input))
+ ('equal (equal old-input new-input))
+ ('substring (string-match-p (regexp-quote old-input)
new-input))))))
(provide 'cape)
;;; cape.el ends here
- [elpa] externals/cape 4b424150ef 090/146: cape-super-capf: Delete duplicates (Fix #13), (continued)
- [elpa] externals/cape 4b424150ef 090/146: cape-super-capf: Delete duplicates (Fix #13), ELPA Syncer, 2022/01/09
- [elpa] externals/cape da32e232d6 093/146: cape--company-call: Cheaper timeout checking, throw error, ELPA Syncer, 2022/01/09
- [elpa] externals/cape c4d821d55b 079/146: Add cape--symbol-annotation, ELPA Syncer, 2022/01/09
- [elpa] externals/cape 2ce63259d7 097/146: Update README - Asynchronous Company backends work as expected, ELPA Syncer, 2022/01/09
- [elpa] externals/cape c1f7fa746b 104/146: Improve synchronization, ELPA Syncer, 2022/01/09
- [elpa] externals/cape 1d69a06890 117/146: cape-tex/cape-sgml: Add autoloads, ELPA Syncer, 2022/01/09
- [elpa] externals/cape 7f11b354df 124/146: cape-company-capf: Remove symbol restriction, ELPA Syncer, 2022/01/09
- [elpa] externals/cape a6db83b1bd 135/146: Improve repair function, ELPA Syncer, 2022/01/09
- [elpa] externals/cape f26e835929 131/146: README: Do not use hashed symbol, ELPA Syncer, 2022/01/09
- [elpa] externals/cape e23226cb1c 022/146: cape-file-capf: Add company-prefix-length=t after slash (Fix #8), ELPA Syncer, 2022/01/09
- [elpa] externals/cape e2fd7c1cc6 038/146: Minor refactoring,
ELPA Syncer <=
- [elpa] externals/cape 3beed4f37c 047/146: Use cape--silent, ELPA Syncer, 2022/01/09
- [elpa] externals/cape 12f5ae008c 051/146: Update README, ELPA Syncer, 2022/01/09
- [elpa] externals/cape 1b4b739639 059/146: Refactoring, ELPA Syncer, 2022/01/09
- [elpa] externals/cape b63deab5af 058/146: cape--cached-table: Add category, ELPA Syncer, 2022/01/09
- [elpa] externals/cape 11bcf51724 064/146: Ensure that cape-line is not sorted, ELPA Syncer, 2022/01/09
- [elpa] externals/cape 33850ae000 068/146: Unify cape-dict and cape-dict-capf, ELPA Syncer, 2022/01/09
- [elpa] externals/cape 241dde47ca 070/146: Unify cape-keyword and cape-keyword-capf, ELPA Syncer, 2022/01/09
- [elpa] externals/cape eaa408779e 072/146: cape-symbol: Implement capf, ELPA Syncer, 2022/01/09
- [elpa] externals/cape eff4f34841 084/146: Add cape-noninterruptible-capf, ELPA Syncer, 2022/01/09
- [elpa] externals/cape fd8828cff3 100/146: Make cape--company-call more robust, ELPA Syncer, 2022/01/09