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

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

[elpa] externals/corfu ba649bfc1e 1/2: Revert "Use the cycle-sort-functi


From: ELPA Syncer
Subject: [elpa] externals/corfu ba649bfc1e 1/2: Revert "Use the cycle-sort-function when cycling (Fix #113)"
Date: Sun, 30 Jan 2022 18:57:22 -0500 (EST)

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

    Revert "Use the cycle-sort-function when cycling (Fix #113)"
    
    This reverts commit 085eb192da194f90ebfa6b9e405fe8f459bd2205.
---
 corfu.el | 23 ++++++++++-------------
 1 file changed, 10 insertions(+), 13 deletions(-)

diff --git a/corfu.el b/corfu.el
index 51f718666a..871b06f2a6 100644
--- a/corfu.el
+++ b/corfu.el
@@ -562,14 +562,12 @@ A scroll bar is displayed from LO to LO+BAR."
                     "\\)\\'")))
     (or (seq-remove (lambda (x) (string-match-p re x)) files) files)))
 
-(defun corfu--sort-function (cycle)
-  "Return the (CYCLE or display) sort function."
-  (or (corfu--metadata-get (if cycle 'cycle-sort-function 
'display-sort-function))
-      corfu-sort-function))
-
-(defun corfu--recompute-candidates (str pt table pred cycle)
-  "Recompute candidates from STR, PT, TABLE and PRED.
-Either use the CYCLE or the display sort function."
+(defun corfu--sort-function ()
+  "Return the sorting function."
+  (or (corfu--metadata-get 'display-sort-function) corfu-sort-function))
+
+(defun corfu--recompute-candidates (str pt table pred)
+  "Recompute candidates from STR, PT, TABLE and PRED."
   (pcase-let* ((before (substring str 0 pt))
                (after (substring str pt))
                (corfu--metadata (completion-metadata before table pred))
@@ -587,9 +585,8 @@ Either use the CYCLE or the display sort function."
     ;; since this breaks the special casing in the 
`completion-file-name-table' for `file-exists-p'
     ;; and `file-directory-p'.
     (when completing-file (setq all (corfu--filter-files all)))
-    (setq all (funcall (or (corfu--sort-function cycle) #'identity) all)
-          all (delete-consecutive-dups all)
-          all (corfu--move-prefix-candidates-to-front field all))
+    (setq all (delete-consecutive-dups (funcall (or (corfu--sort-function) 
#'identity) all)))
+    (setq all (corfu--move-prefix-candidates-to-front field all))
     (when (and completing-file (not (string-suffix-p "/" field)))
       (setq all (corfu--move-to-front (concat field "/") all)))
     (setq all (corfu--move-to-front field all))
@@ -608,7 +605,7 @@ Either use the CYCLE or the display sort function."
   ;; expensive candidate recomputation is performed (Issue #48). See also
   ;; corresponding vertico#89.
   (redisplay)
-  (pcase (while-no-input (corfu--recompute-candidates str pt table pred nil))
+  (pcase (while-no-input (corfu--recompute-candidates str pt table pred))
     ('nil (keyboard-quit))
     (`(,base ,candidates ,total ,hl ,metadata ,preselect)
      (setq corfu--input (cons str pt)
@@ -1075,7 +1072,7 @@ See `completion-in-region' for the arguments BEG, END, 
TABLE, PRED."
          t)
         (`(,newstr . ,newpt)
          (pcase-let ((`(,base ,candidates ,total . ,_)
-                      (corfu--recompute-candidates str pt table pred 'cycle)))
+                      (corfu--recompute-candidates str pt table pred)))
            (setq beg (copy-marker beg)
                  end (copy-marker end t)
                  completion-in-region--data (list beg end table pred))



reply via email to

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