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

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

[elpa] externals/cape 8cf2942881 085/146: Add comments regarding interru


From: ELPA Syncer
Subject: [elpa] externals/cape 8cf2942881 085/146: Add comments regarding interruptible completion tables
Date: Sun, 9 Jan 2022 20:57:44 -0500 (EST)

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

    Add comments regarding interruptible completion tables
    
    cc @jdtsmith
---
 cape.el | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/cape.el b/cape.el
index d38e29c6f9..e2689a9f94 100644
--- a/cape.el
+++ b/cape.el
@@ -367,7 +367,10 @@ VALID is the input comparator, see `cape--input-valid-p'."
     (lambda (str pred action)
       (let ((new-input (buffer-substring-no-properties beg end)))
         (when (or (eq input 'init) (not (cape--input-valid-p input new-input 
valid)))
-          (setq table (funcall fun new-input) input new-input)))
+          ;; NOTE: We have to make sure that the completion table is 
interruptible.
+          ;; An interruption should not happen between the setqs.
+          (setq table (funcall fun new-input)
+                input new-input)))
       (complete-with-action action table str pred))))
 
 (defvar cape--file-properties
@@ -624,6 +627,8 @@ If INTERACTIVE is nil the function acts like a capf."
                (lambda (str pred action)
                  (when (eq candidates 'init)
                    (clrhash ht)
+                   ;; NOTE: Set `candidates' in the end, such that the 
completion table is
+                   ;; interruptible.
                    (setq candidates
                          (cl-loop for (table . plist) in tables nconc
                                   (let* ((pred (plist-get plist :predicate))
@@ -715,6 +720,8 @@ VALID is the input comparator, see `cape--input-valid-p'."
                      (unless (cape--input-valid-p input new-input valid)
                        (pcase (funcall capf)
                          (`(,_beg ,_end ,new-table . ,_plist)
+                          ;; NOTE: We have to make sure that the completion 
table is interruptible.
+                          ;; An interruption should not happen between the 
setqs.
                           (setq table new-table input new-input)))))
                    (complete-with-action action table str pred)))
               ,@plist)))))
@@ -773,7 +780,8 @@ completion :category symbol can be specified."
       (`(,beg ,end ,table . ,plist)
        `(,beg ,end
               ,(lambda (str pred action)
-                 (cape--silent (complete-with-action action table str pred)))
+                 (cape--silent
+                  (complete-with-action action table str pred)))
               ,@plist)))))
 
 ;;;###autoload
@@ -784,7 +792,8 @@ completion :category symbol can be specified."
       (`(,beg ,end ,table . ,plist)
        `(,beg ,end
               ,(lambda (str pred action)
-                 (let (throw-on-input) (complete-with-action action table str 
pred)))
+                 (let (throw-on-input)
+                   (complete-with-action action table str pred)))
               ,@plist)))))
 
 ;;;###autoload



reply via email to

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