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

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

[elpa] externals/corfu 3facc34 3/3: Revert "Rework the quit handling"


From: ELPA Syncer
Subject: [elpa] externals/corfu 3facc34 3/3: Revert "Rework the quit handling"
Date: Sat, 26 Jun 2021 04:57:08 -0400 (EDT)

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

    Revert "Rework the quit handling"
    
    This reverts commit 961f21dd425471f61c59fd9ab4b1b17cb3273860.
---
 corfu.el | 53 +++++++++++++++++++++++------------------------------
 1 file changed, 23 insertions(+), 30 deletions(-)

diff --git a/corfu.el b/corfu.el
index 9f06a87..a39b716 100644
--- a/corfu.el
+++ b/corfu.el
@@ -501,39 +501,31 @@ filter string with spaces is allowed."
      ;; TODO Report this as a bug? Are completion tables supposed to throw 
errors?
      ((condition-case err
           (unless (equal corfu--input (cons str pt))
-            (corfu--update-candidates str metadata pt table pred)
-            nil)
+            (and (corfu--update-candidates str metadata pt table pred)) nil)
         (t (message "%s" (error-message-string err))
-           (corfu-quit)
-           t)))
-     ;; 1) Initializing and there are no candidates
-     ;; => Quit with error message
-     ((and (not corfu--candidates) initializing)
-      (minibuffer-message "No match")
-      (corfu-quit))
-     ;; 2) There are no candidates
-     ;; => Show confirmation popup
-     ((not (or corfu--candidates corfu-quit-no-match))
-      (corfu--popup-show beg '(#("No match" 0 8 (face italic)))))
-     ;; 3) There exist candidates
-     ;; &  Not a sole exactly matching candidate
-     ;; &  Input is non-empty or continue command
-     ;; => Show candidates popup
-     ((and corfu--candidates
-           (not (equal corfu--candidates (list str)))
-           (or (/= beg end) (corfu--continue-p)))
-      (corfu--show-candidates beg end str metadata))
-     ;; 4) When after `completion-at-point/corfu-complete', no further 
completion is possible and
-     ;; the current string is a valid match, exit with status 'finished.
+           nil)))
+     ((and (not corfu--candidates)                    ;; 1) There are no 
candidates
+           initializing)                              ;; &  Initializing, 
first retrieval of candidates.
+      (minibuffer-message "No match")                 ;; => Show error message
+      nil)
+     ((and corfu--candidates                          ;; 2) There exist 
candidates
+           (not (equal corfu--candidates (list str))) ;; &  Not a sole exactly 
matching candidate
+           (or (/= beg end) (corfu--continue-p)))     ;; &  Input is non-empty 
or continue command
+      (corfu--show-candidates beg end str metadata)   ;; => Show candidates 
popup
+      t)
+     ;; 3) When after `completion-at-point/corfu-complete', no further 
completion is possible and the
+     ;; current string is a valid match, exit with status 'finished.
      ((and (memq this-command '(corfu-complete completion-at-point))
            (not (stringp (try-completion str table pred)))
            ;; XXX We should probably use `completion-try-completion' here 
instead
            ;; but it does not work as well when completing in `shell-mode'.
            ;; (not (consp (completion-try-completion str table pred pt 
metadata)))
            (test-completion str table pred))
-      (corfu--done str 'finished))
-     ;; Otherwise quit
-     (t (corfu-quit)))))
+      (corfu--done str 'finished)
+      nil)
+     ((not (or corfu--candidates corfu-quit-no-match))           ;; 4) There 
are no candidates
+      (corfu--popup-show beg '(#("No match" 0 8 (face italic)))) ;; => Show 
confirmation popup
+      t))))
 
 (defun corfu--pre-command ()
   "Insert selected candidate unless command is marked to continue completion."
@@ -544,10 +536,11 @@ filter string with spaces is allowed."
 (defun corfu--post-command ()
   "Refresh Corfu after last command."
   (remove-hook 'window-configuration-change-hook #'corfu--popup-hide)
-  (pcase completion-in-region--data
-    (`(,beg ,end ,_table ,_pred)
-     (when (and (eq (marker-buffer beg) (current-buffer)) (<= beg (point) end))
-       (corfu--update)))))
+  (or (pcase completion-in-region--data
+        (`(,beg ,end ,_table ,_pred)
+         (when (and (eq (marker-buffer beg) (current-buffer)) (<= beg (point) 
end))
+           (corfu--update))))
+      (corfu-quit)))
 
 (defun corfu--goto (index)
   "Go to candidate with INDEX."



reply via email to

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