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

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

[elpa] externals/orderless f6fe5e17e6 01/11: Optimize orderless-try-comp


From: ELPA Syncer
Subject: [elpa] externals/orderless f6fe5e17e6 01/11: Optimize orderless-try-completion predicate calling convention
Date: Thu, 15 Feb 2024 15:58:53 -0500 (EST)

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

    Optimize orderless-try-completion predicate calling convention
    
    Only allocate a rest argument list if the predicate is used on hash table
    candidates.
---
 orderless.el | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/orderless.el b/orderless.el
index e914a6b8a1..a55c62804e 100644
--- a/orderless.el
+++ b/orderless.el
@@ -472,15 +472,15 @@ This function is part of the `orderless' completion 
style."
       ;; called more than two times.
       (orderless-filter
        string table
-       ;; key/value for hash tables
-       (lambda (&rest args)
-         (when (or (not pred) (apply pred args))
-           (setq args (car args) ;; first argument is key
-                 args (if (consp args) (car args) args) ;; alist
-                 args (if (symbolp args) (symbol-name args) args))
-           (when (and one (not (equal one args)))
+       (lambda (arg &rest val) ;; val for hash table
+         (when (or (not pred) (if val (funcall pred arg (car val)) (funcall 
pred arg)))
+           ;; Normalize predicate argument
+           (setq arg (if (consp arg) (car arg) arg) ;; alist
+                 arg (if (symbolp arg) (symbol-name arg) arg)) ;; symbols
+           ;; Check if there is more than a single match (= many).
+           (when (and one (not (equal one arg)))
              (throw 'orderless--many (cons string point)))
-           (setq one args)
+           (setq one arg)
            t)))
       (when one
         ;; Prepend prefix if the candidate does not already have the same



reply via email to

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