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

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

[elpa] externals/orderless 37c0083736 14/25: orderless--dispatch: Explic


From: ELPA Syncer
Subject: [elpa] externals/orderless 37c0083736 14/25: orderless--dispatch: Explicitly specify the arguments
Date: Wed, 21 Feb 2024 12:58:51 -0500 (EST)

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

    orderless--dispatch: Explicitly specify the arguments
    
    - The dispatchers have a fixed calling convention.
    - Explicitly specifying the arguments is both safer and more efficient.
---
 orderless.el | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/orderless.el b/orderless.el
index a28f4b1acf..534ae3423b 100644
--- a/orderless.el
+++ b/orderless.el
@@ -343,17 +343,18 @@ converted to a list of regexps according to the value of
                  " +" t)))
 
 (define-obsolete-function-alias 'orderless-dispatch 'orderless--dispatch "1.0")
-(defun orderless--dispatch (dispatchers default string &rest args)
+(defun orderless--dispatch (dispatchers default string index total)
   "Run DISPATCHERS to compute matching styles for STRING.
 
-A style dispatcher is a function that takes a string and possibly
-some extra arguments.  It should either return (a) nil to
-indicate the dispatcher will not handle the string, (b) a new
-string to replace the current string and continue dispatch,
-or (c) the matching styles to use and, if needed, a new string to
-use in place of the current one (for example, a dispatcher can
-decide which style to use based on a suffix of the string and
-then it must also return the component stripped of the suffix).
+A style dispatcher is a function that takes a STRING, component
+INDEX and the TOTAL number of components.  It should either
+return (a) nil to indicate the dispatcher will not handle the
+string, (b) a new string to replace the current string and
+continue dispatch, or (c) the matching styles to use and, if
+needed, a new string to use in place of the current one (for
+example, a dispatcher can decide which style to use based on a
+suffix of the string and then it must also return the component
+stripped of the suffix).
 
 More precisely, the return value of a style dispatcher can be of
 one of the following forms:
@@ -370,13 +371,12 @@ one of the following forms:
   whose `cdr' is a string (to replace the current one).
 
 This function tries all DISPATCHERS in sequence until one returns
-a list of styles (passing any extra ARGS to every style
-dispatcher).  When that happens it returns a `cons' of the list
-of styles and the possibly updated STRING.  If none of the
+a list of styles.  When that happens it returns a `cons' of the
+list of styles and the possibly updated STRING.  If none of the
 DISPATCHERS returns a list of styles, the return value will use
 DEFAULT as the list of styles."
   (cl-loop for dispatcher in dispatchers
-           for result = (apply dispatcher string args)
+           for result = (funcall dispatcher string index total)
            if (stringp result)
            do (setq string result result nil)
            else if (and (consp result) (null (car result)))



reply via email to

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