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

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

[elpa] externals/cape 3c44bff1f6 095/146: Minor refactoring


From: ELPA Syncer
Subject: [elpa] externals/cape 3c44bff1f6 095/146: Minor refactoring
Date: Sun, 9 Jan 2022 20:57:45 -0500 (EST)

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

    Minor refactoring
---
 cape.el | 28 ++++++++++++++++------------
 1 file changed, 16 insertions(+), 12 deletions(-)

diff --git a/cape.el b/cape.el
index f1e0404ae5..792306c3fb 100644
--- a/cape.el
+++ b/cape.el
@@ -320,6 +320,18 @@
        (completion-in-region beg end table (plist-get extra :predicate))))
     (_ (user-error "%s: No completions" capf))))
 
+(defun cape--noninterruptible-table (table)
+  "Create non-interruptible completion TABLE."
+  (lambda (str pred action)
+    (let (throw-on-input)
+      (complete-with-action action table str pred))))
+
+(defun cape--silent-table (table)
+  "Create a new completion TABLE which is silent (no messages, no errors)."
+  (lambda (str pred action)
+    (cape--silent
+      (complete-with-action action table str pred))))
+
 (cl-defun cape--table-with-properties (table &key category (sort t) 
&allow-other-keys)
   "Create completion TABLE with properties.
 CATEGORY is the optional completion category.
@@ -836,27 +848,19 @@ The PREDICATE is passed the candidate symbol or string."
 
 ;;;###autoload
 (defun cape-silent-capf (capf)
-  "Return a new CAPF which is silent (no messages, no errors)."
+  "Create a new CAPF which is silent (no messages, no errors)."
   (lambda ()
     (pcase (cape--silent (funcall capf))
       (`(,beg ,end ,table . ,plist)
-       `(,beg ,end
-              ,(lambda (str pred action)
-                 (cape--silent
-                  (complete-with-action action table str pred)))
-              ,@plist)))))
+       `(,beg ,end ,(cape--silent-table table) ,@plist)))))
 
 ;;;###autoload
 (defun cape-noninterruptible-capf (capf)
-  "Return a new CAPF which is non-interruptible silent by input."
+  "Create a new CAPF which is non-interruptible silent by input."
   (lambda ()
     (pcase (let (throw-on-input) (funcall capf))
       (`(,beg ,end ,table . ,plist)
-       `(,beg ,end
-              ,(lambda (str pred action)
-                 (let (throw-on-input)
-                   (complete-with-action action table str pred)))
-              ,@plist)))))
+       `(,beg ,end ,(cape--noninterruptible-table table) ,@plist)))))
 
 ;;;###autoload
 (defun cape-interactive-capf (capf)



reply via email to

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