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

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

[elpa] externals/vertico f096059c68 1/5: Minor refactoring


From: ELPA Syncer
Subject: [elpa] externals/vertico f096059c68 1/5: Minor refactoring
Date: Sat, 8 Jan 2022 11:57:49 -0500 (EST)

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

    Minor refactoring
---
 vertico.el | 45 ++++++++++++++++++++-------------------------
 1 file changed, 20 insertions(+), 25 deletions(-)

diff --git a/vertico.el b/vertico.el
index 15935e25ab..f115bc7225 100644
--- a/vertico.el
+++ b/vertico.el
@@ -324,18 +324,16 @@ The function is configured by BY, BSIZE, BINDEX, BPRED 
and PRED."
                ;; if the cursor is moved between the slashes of "~//".
                ;; See also marginalia.el which has the same issue.
                (bounds (or (condition-case nil
-                               (completion-boundaries before
-                                                      
minibuffer-completion-table
-                                                      
minibuffer-completion-predicate
-                                                      after)
+                               (completion-boundaries
+                                before minibuffer-completion-table
+                                minibuffer-completion-predicate after)
                              (t (cons 0 (length after))))))
                (field (substring content (car bounds) (+ pt (cdr bounds))))
                ;; `minibuffer-completing-file-name' has been obsoleted by the 
completion category
                (completing-file (eq 'file (vertico--metadata-get 'category)))
-               (`(,all . ,hl) (vertico--all-completions content
-                                                        
minibuffer-completion-table
-                                                        
minibuffer-completion-predicate
-                                                        pt vertico--metadata))
+               (`(,all . ,hl) (vertico--all-completions
+                               content minibuffer-completion-table
+                               minibuffer-completion-predicate pt 
vertico--metadata))
                (base (or (when-let (z (last all)) (prog1 (cdr z) (setcdr z 
nil))) 0))
                (base-str (substring content 0 base))
                (def (or (car-safe minibuffer-default) minibuffer-default))
@@ -346,8 +344,7 @@ The function is configured by BY, BSIZE, BINDEX, BPRED and 
PRED."
     ;; Filter the ignored file extensions. We cannot use modified predicate 
for this filtering,
     ;; 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 (vertico--filter-files all)))
+    (when completing-file (setq all (vertico--filter-files all)))
     ;; Sort using the `display-sort-function' or the Vertico sort functions
     (setq all (delete-consecutive-dups (funcall (or (vertico--sort-function) 
#'identity) all)))
     ;; Move special candidates: "field" appears at the top, before "field/", 
before default value
@@ -612,8 +609,8 @@ The function is configured by BY, BSIZE, BINDEX, BPRED and 
PRED."
 
 (defun vertico--allow-prompt-selection-p ()
   "Return t if prompt can be selected."
-  (or vertico--default-missing
-      (memq minibuffer--require-match '(nil confirm 
confirm-after-completion))))
+  (or vertico--default-missing (memq minibuffer--require-match
+                                     '(nil confirm confirm-after-completion))))
 
 (defun vertico--goto (index)
   "Go to candidate with INDEX."
@@ -682,19 +679,17 @@ The function is configured by BY, BSIZE, BINDEX, BPRED 
and PRED."
 When the prefix argument is 0, the group order is reset."
   (interactive "p")
   (when (cdr vertico--groups)
-    (if (eq n 0)
-        (setq vertico--groups nil
-              vertico--all-groups nil
-              vertico--lock-groups nil)
-      (setq vertico--groups
-            (vertico--cycle vertico--groups
-                            (let ((len (length vertico--groups)))
-                              (- len (mod (- (or n 1)) len))))
-            vertico--all-groups
-            (vertico--cycle vertico--all-groups
-                            (seq-position vertico--all-groups
-                                          (car vertico--groups)))
-            vertico--lock-groups t))
+    (if (setq vertico--lock-groups (not (eq n 0)))
+        (setq vertico--groups
+              (vertico--cycle vertico--groups
+                              (let ((len (length vertico--groups)))
+                                (- len (mod (- (or n 1)) len))))
+              vertico--all-groups
+              (vertico--cycle vertico--all-groups
+                              (seq-position vertico--all-groups
+                                            (car vertico--groups))))
+      (setq vertico--groups nil
+            vertico--all-groups nil))
     (setq vertico--lock-candidate nil
           vertico--input nil)))
 



reply via email to

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