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

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

[elpa] externals/vertico 5261e34380: Simplify vertico--define-sort


From: ELPA Syncer
Subject: [elpa] externals/vertico 5261e34380: Simplify vertico--define-sort
Date: Sun, 7 May 2023 10:00:46 -0400 (EDT)

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

    Simplify vertico--define-sort
---
 vertico.el | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/vertico.el b/vertico.el
index fe5c6acbfe..3dcee9a9ed 100644
--- a/vertico.el
+++ b/vertico.el
@@ -231,15 +231,11 @@ The function is configured by BY, BSIZE, BINDEX, BPRED 
and PRED."
      (let* ((buckets (make-vector ,bsize nil))
             ,@(and (eq (car by) 'history) '((hhash (vertico--history-hash)) 
(hcands))))
        (dolist (% candidates)
-         ,(if (eq (car by) 'history)
-              ;; Find recent candidates or fill buckets
-              `(if-let (idx (gethash % hhash))
-                   (push (cons idx %) hcands)
-                 (let ((idx (min ,(1- bsize) ,bindex)))
-                   (aset buckets idx (cons % (aref buckets idx)))))
-            ;; Fill buckets
-            `(let ((idx (min ,(1- bsize) ,bindex)))
-               (aset buckets idx (cons % (aref buckets idx))))))
+         ;; Find recent candidate in history or fill bucket
+         (,@(if (not (eq (car by) 'history)) `(progn)
+              `(if-let (idx (gethash % hhash)) (push (cons idx %) hcands)))
+          (let ((idx (min ,(1- bsize) ,bindex)))
+            (aset buckets idx (cons % (aref buckets idx))))))
        (nconc ,@(and (eq (car by) 'history) '((vertico--sort-decorated 
hcands)))
               (mapcan (lambda (bucket) (sort bucket #',bpred))
                       (nbutlast (append buckets nil)))



reply via email to

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