emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/cape 16ef21309b 076/146: Improve cape-dabbrev


From: ELPA Syncer
Subject: [elpa] externals/cape 16ef21309b 076/146: Improve cape-dabbrev
Date: Sun, 9 Jan 2022 20:57:44 -0500 (EST)

branch: externals/cape
commit 16ef21309b6f2efaab6bb03adba91ef229568c45
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>

    Improve cape-dabbrev
---
 cape.el | 29 ++++++++++++++++-------------
 1 file changed, 16 insertions(+), 13 deletions(-)

diff --git a/cape.el b/cape.el
index 1ba8d46986..2b909c7eec 100644
--- a/cape.el
+++ b/cape.el
@@ -442,17 +442,17 @@ If INTERACTIVE is nil the function acts like a capf."
         (search-forward abbrev)
         (setq end (point)))
       (if interactive
-          (cape--complete beg end (cape--dabbrev-table beg end) 
cape--dabbrev-properties)
-        `(,beg ,end ,(cape--dabbrev-table beg end)
+          (cape--complete beg end
+                          (cape--cached-table beg end 
#'cape--dabbrev-expansions
+                                              :valid 'prefix :category 
'cape-dabbrev)
+                          cape--dabbrev-properties)
+        `(,beg ,end
+               ;; Use equal check, since candidates must be longer than 
cape-dabbrev-min-length
+               ,(cape--cached-table beg end #'cape--dabbrev-limited-expansions
+                                    :valid 'equal :category 'cape-dabbrev)
                :exclusive no ,@cape--dabbrev-properties)))
      (interactive (user-error "No expansion")))))
 
-(defun cape--dabbrev-table (beg end)
-  "Dabbrev completion table for string between BEG and END."
-  ;; Use equal check, since candidates must be longer than 
cape-dabbrev-min-length
-  (cape--cached-table beg end #'cape--dabbrev-expansions
-                      :valid 'equal :category 'cape-dabbrev))
-
 (defun cape--dabbrev-reset ()
   "Reset dabbrev state."
   (let ((dabbrev-check-all-buffers nil)
@@ -461,12 +461,15 @@ If INTERACTIVE is nil the function acts like a capf."
 
 (defun cape--dabbrev-expansions (word)
   "Find all dabbrev expansions for WORD."
-  (cape--dabbrev-reset)
   (cape--silent
-   (cl-loop
-    with min-len = (+ cape-dabbrev-min-length (length word))
-    for w in (dabbrev--find-all-expansions word (dabbrev--ignore-case-p word))
-    if (>= (length w) min-len) collect w)))
+   (cape--dabbrev-reset)
+   (dabbrev--find-all-expansions word (dabbrev--ignore-case-p word))))
+
+(defun cape--dabbrev-limited-expansions (word)
+  "Find all dabbrev expansions for WORD."
+   (cl-loop with min-len = (+ cape-dabbrev-min-length (length word))
+            for w in (cape--dabbrev-expansions word)
+            if (>= (length w) min-len) collect w))
 
 (defvar cape--ispell-properties
   (list :annotation-function (lambda (_) " Ispell")



reply via email to

[Prev in Thread] Current Thread [Next in Thread]