[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/cape 04a332c5fe 036/146: Extract cape--input-changed-p
From: |
ELPA Syncer |
Subject: |
[elpa] externals/cape 04a332c5fe 036/146: Extract cape--input-changed-p |
Date: |
Sun, 9 Jan 2022 20:57:40 -0500 (EST) |
branch: externals/cape
commit 04a332c5fe24ac112155e49e2c7934ae97007198
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>
Extract cape--input-changed-p
---
cape.el | 28 ++++++++++++++++------------
1 file changed, 16 insertions(+), 12 deletions(-)
diff --git a/cape.el b/cape.el
index aa58f62d18..f98403a513 100644
--- a/cape.el
+++ b/cape.el
@@ -396,8 +396,8 @@
(let ((new-input (buffer-substring-no-properties beg end)))
(when (or (eq words 'init) (not (string-match-p (regexp-quote input)
new-input)))
(setq input new-input
- words (with-demoted-errors
- (require 'ispell)
+ words (with-demoted-errors "Ispell Error: %S"
+ (require 'ispell)
(let ((message-log-max nil)
(inhibit-message t))
(ispell-lookup-words (format "*%s*" input)))))))
@@ -620,10 +620,7 @@ This feature is experimental."
(defun cape-capf-buster (capf &optional cmp)
"Return transformed CAPF where the cache is busted on input change.
-The CMP argument determines how the new input is compared to the old input.
-- prefix/nil: Preserve cache when the old input is a prefix of the new input.
-- equal: Preserve cache when the old input is equal to the new input.
-- substring: Preserve cache when the old input is a substring of the new
input."
+See `cape--input-changed-p' for the CMP argument."
(lambda ()
(pcase (funcall capf)
(`(,beg ,end ,table . ,plist)
@@ -632,17 +629,24 @@ The CMP argument determines how the new input is compared
to the old input.
`(,beg ,end
,(lambda (str pred action)
(let ((new-input (buffer-substring-no-properties start
(point))))
- (unless (or
- (pcase-exhaustive cmp
- ((or 'prefix 'nil) (not (string-prefix-p input
new-input)))
- ('equal (equal new-input input))
- ('substring (not (string-match-p (regexp-quote
input) new-input))))
- (string-match-p "\\s-" new-input))
+ (when (and (not (string-match-p "\\s-" new-input))
+ (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))))))
+(defun cape--input-changed-p (old-input new-input cmp)
+ "Return non-nil if the NEW-INPUT has changed in comparison to OLD-INPUT.
+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)))))
+
(provide 'cape)
;;; cape.el ends here
- [elpa] externals/cape 0cc116b29c 012/146: Implement company adapter (See #1), (continued)
- [elpa] externals/cape 0cc116b29c 012/146: Implement company adapter (See #1), ELPA Syncer, 2022/01/09
- [elpa] externals/cape 845f3483f1 019/146: company-merge-capfs: Add support for :company-prefix-length, ELPA Syncer, 2022/01/09
- [elpa] externals/cape 31acb66152 021/146: Update README, ELPA Syncer, 2022/01/09
- [elpa] externals/cape adb54fc562 020/146: Add missing autoload, ELPA Syncer, 2022/01/09
- [elpa] externals/cape d098cc3cba 023/146: Update README, ELPA Syncer, 2022/01/09
- [elpa] externals/cape ff5b19afc0 025/146: Add missing omit-nulls, ELPA Syncer, 2022/01/09
- [elpa] externals/cape a54a512030 030/146: cape-merge-capfs: Compute candidates later, ELPA Syncer, 2022/01/09
- [elpa] externals/cape 0bdc6ae05c 034/146: README: Mention cape-capf-buster, ELPA Syncer, 2022/01/09
- [elpa] externals/cape 8fd6c17a01 033/146: Add cape-capf-buster, ELPA Syncer, 2022/01/09
- [elpa] externals/cape 90ad5d68d5 037/146: Extract cape--cached-table, ELPA Syncer, 2022/01/09
- [elpa] externals/cape 04a332c5fe 036/146: Extract cape--input-changed-p,
ELPA Syncer <=
- [elpa] externals/cape 882b9d9e79 042/146: Rename cape-merge-capfs, ELPA Syncer, 2022/01/09
- [elpa] externals/cape 9111ad5101 043/146: Ensure that dabbrev is initialized properly, ELPA Syncer, 2022/01/09
- [elpa] externals/cape af4268549c 055/146: Dabbrev: Use equality check, ELPA Syncer, 2022/01/09
- [elpa] externals/cape 29f828cc82 061/146: Reorder, ELPA Syncer, 2022/01/09
- [elpa] externals/cape 80ca6abfd5 063/146: Add cape-line, ELPA Syncer, 2022/01/09
- [elpa] externals/cape 52c86daf8c 062/146: Version 0.2, ELPA Syncer, 2022/01/09
- [elpa] externals/cape 8643892a6d 066/146: Minor refactoring, ELPA Syncer, 2022/01/09
- [elpa] externals/cape 0fdbf4f5c3 073/146: cape-line: Implement capf, ELPA Syncer, 2022/01/09
- [elpa] externals/cape 16ef21309b 076/146: Improve cape-dabbrev, ELPA Syncer, 2022/01/09
- [elpa] externals/cape edb2be3b71 092/146: Version 0.3, ELPA Syncer, 2022/01/09