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

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

[elpa] externals/cape eff4f34841 084/146: Add cape-noninterruptible-capf


From: ELPA Syncer
Subject: [elpa] externals/cape eff4f34841 084/146: Add cape-noninterruptible-capf
Date: Sun, 9 Jan 2022 20:57:44 -0500 (EST)

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

    Add cape-noninterruptible-capf
---
 README.org |  1 +
 cape.el    | 11 +++++++++++
 2 files changed, 12 insertions(+)

diff --git a/README.org b/README.org
index 44ca3b1770..99c129b8e1 100644
--- a/README.org
+++ b/README.org
@@ -125,5 +125,6 @@ achieve a similarly refreshing strategy.
 ** Other Capf transformers
 
 - ~cape-silent-capf~: Wrap a chatty Capf and silence it.
+- ~cape-noninterruptible-capf~: Protect a Capf which does not like to be 
interrupted.
 - ~cape-interactive-capf~: Create a Capf which can be called interactively.
 - ~cape-capf-with-properties~: Add completion properties to a Capf.
diff --git a/cape.el b/cape.el
index 9db9945b67..d38e29c6f9 100644
--- a/cape.el
+++ b/cape.el
@@ -776,6 +776,17 @@ completion :category symbol can be specified."
                  (cape--silent (complete-with-action action table str pred)))
               ,@plist)))))
 
+;;;###autoload
+(defun cape-noninterruptible-capf (capf)
+  "Return 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)))))
+
 ;;;###autoload
 (defun cape-interactive-capf (capf)
   "Create interactive completion function from CAPF."



reply via email to

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