[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)))
- [elpa] externals/orderless 7af2ee23d8 22/25: orderless-compile: Expand docstring, (continued)
- [elpa] externals/orderless 7af2ee23d8 22/25: orderless-compile: Expand docstring, ELPA Syncer, 2024/02/21
- [elpa] externals/orderless 9e810f43f0 21/25: Simplify orderless--compile-component, ELPA Syncer, 2024/02/21
- [elpa] externals/orderless 91df48c8e1 25/25: Merge pull request #162 from minad/annotation-matching, ELPA Syncer, 2024/02/21
- [elpa] externals/orderless 71a4557269 19/25: Rename orderless-without to orderless-not, ELPA Syncer, 2024/02/21
- [elpa] externals/orderless c1def76024 01/25: Pattern compiler: Compile to regexps and a predicate function, ELPA Syncer, 2024/02/21
- [elpa] externals/orderless b770a4de47 05/25: Remove orderless--predicate-or, ELPA Syncer, 2024/02/21
- [elpa] externals/orderless 10bce1bcde 02/25: orderless-annotation, orderless-without-regexp: Check validity, ELPA Syncer, 2024/02/21
- [elpa] externals/orderless 0e9fe2e902 03/25: orderless-annotation: Also check completion-extra-properties, ELPA Syncer, 2024/02/21
- [elpa] externals/orderless 7c99212dd3 17/25: Alternative 2: Compile component before passing it to orderless-annotation, ELPA Syncer, 2024/02/21
- [elpa] externals/orderless b56db3eea4 18/25: Turn orderless-annotation/without into a "pattern transformer", ELPA Syncer, 2024/02/21
- [elpa] externals/orderless 37c0083736 14/25: orderless--dispatch: Explicitly specify the arguments,
ELPA Syncer <=
- [elpa] externals/orderless 766a194b90 13/25: Use orderless--dispatch in orderless--compile-component, ELPA Syncer, 2024/02/21
- [elpa] externals/orderless fe5b6672b4 15/25: Add comment regarding the orderless--component-compiler calls, ELPA Syncer, 2024/02/21
- [elpa] externals/orderless 258b9f54e1 23/25: README: Fix language after renaming of orderless-pattern-compiler, ELPA Syncer, 2024/02/21
- [elpa] externals/orderless f172c80136 04/25: Extend orderless-without-literal comment, ELPA Syncer, 2024/02/21
- [elpa] externals/orderless c484594875 11/25: Update documentation of orderless-style-dispatchers, ELPA Syncer, 2024/02/21
- [elpa] externals/orderless add8d5af3a 24/25: Break long lines, ELPA Syncer, 2024/02/21