[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/orderless c245cb6e9d 091/204: Make dispatchers always t
From: |
ELPA Syncer |
Subject: |
[elpa] externals/orderless c245cb6e9d 091/204: Make dispatchers always take 3 args (to avoid depending on 26.1) |
Date: |
Tue, 11 Jan 2022 12:58:20 -0500 (EST) |
branch: externals/orderless
commit c245cb6e9d967ece0d64b573021a63399013df53
Author: Omar Antolín <omar.antolin@gmail.com>
Commit: Omar Antolín <omar.antolin@gmail.com>
Make dispatchers always take 3 args (to avoid depending on 26.1)
func-arity was introduced in 26.1
---
orderless.el | 62 ++++++++++++++++++++++++++++--------------------------------
1 file changed, 29 insertions(+), 33 deletions(-)
diff --git a/orderless.el b/orderless.el
index 82fbcd8d65..9af347e5d5 100644
--- a/orderless.el
+++ b/orderless.el
@@ -141,21 +141,20 @@ of the input string if all the style dispatchers in
The `orderless' completion style splits the input into components
and for each component tries all style dispatchers stored in this
variable one at a time until one handles the component (details
-below). If no dispatcher handles the component, the matching
+below). If no dispatcher handles the component, the matching
styles in `orderless-component-matching-styles' are applied.
-A style dispatcher is a function of between 1 and 3 arguments, a
-string and 1 or 2 integers. It is called with each component of
-the input string, the component's index (starting from 0), and
-the total number of components --well, it's called with as many
-of those arguments as it can take. It should either return (a)
-nil to indicate the dispatcher will not handle that component at
-that index, (b) a string to replace the component with that
-string and continue dispatch, or (c) the matching styles to use
-and, if needed, a string to use in place of the component (for
-example, a dispatcher can decide which style to use based on a
-suffix of the component and then it must also return the
-component stripped of the suffix).
+A style dispatcher is a function of 3 arguments, a string and 2
+integers. It is called with each component of the input string,
+the component's index (starting from 0), and the total number of
+components. It should either return (a) nil to indicate the
+dispatcher will not handle that component at that index, (b) a
+string to replace the component with that string and continue
+dispatch, or (c) the matching styles to use and, if needed, a
+string to use in place of the component (for example, a
+dispatcher can decide which style to use based on a suffix of the
+component 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:
@@ -176,10 +175,10 @@ a list of regexps that must all match a candidate in
order for
the candidate to be considered a completion of the pattern.
The default pattern compiler is probably flexible enough for most
-users. It splits the input on `orderless-component-separator',
+users. It splits the input on `orderless-component-separator',
and consults both `orderless-style-dispatchers' and
`orderless-component-matching-styles' to decide how to match each
-component. See `orderless-style-dispatchers' for details."
+component. See `orderless-style-dispatchers' for details."
:type 'function
:group 'orderless)
@@ -292,15 +291,12 @@ converted to a list of regexps according to the value of
for string = (copy-sequence original)
collect (orderless--highlight regexps string)))
-(defun orderless--forgiving-funcall (fn &rest args)
- "Call FN with as many ARGS as its arity allows."
- (apply fn (cl-subseq args 0 (cdr (func-arity fn)))))
-
(defun orderless--component-regexps (pattern)
- "Build regexps to match PATTERN.
-Consults `orderless-style-dispatchers' and, if
-necessary,`orderless-component-matching-styles' to decide what to
-match. See `orderless-style-dispatchers' for details.
+ "Build regexps to match the components of PATTERN.
+Split PATTERN on `orderless-component-separator' and consult
+`orderless-style-dispatchers' and, if necessary,
+`orderless-component-matching-styles' to decide what how to match
+each component. See `orderless-style-dispatchers' for details.
This is the default value of `orderless-pattern-compiler'."
(cl-loop
@@ -308,16 +304,16 @@ This is the default value of
`orderless-pattern-compiler'."
with components = (split-string pattern orderless-component-separator)
with total = (length components)
for component in components and index from 0
- for styles = (cl-loop for dispatcher in orderless-style-dispatchers
- for result = (orderless--forgiving-funcall
- dispatcher component index total)
- if (stringp result)
- do (setq component result result nil)
- else if (and (consp result) (stringp (cdr result)))
- do (setq component (cdr result)
- result (or (car result) default))
- thereis result
- finally (return default))
+ for styles = (cl-loop
+ for dispatcher in orderless-style-dispatchers
+ for result = (funcall dispatcher component index total)
+ if (stringp result)
+ do (setq component result result nil)
+ else if (and (consp result) (stringp (cdr result)))
+ do (setq component (cdr result)
+ result (or (car result) default))
+ thereis result
+ finally (return default))
collect
(cond
((functionp styles) (funcall styles component))
- [elpa] externals/orderless 269d7388ab 034/204: Merge pull request #6 from raxod502/patch-1, (continued)
- [elpa] externals/orderless 269d7388ab 034/204: Merge pull request #6 from raxod502/patch-1, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless ae466bc4f4 054/204: Rename orderless-regexp-separator to orderless-component-separator, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless aad0aa8a8d 017/204: Copy candidates to avoid permanently changing their face, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless 9218343171 043/204: Add command to temporarily change separator, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless 2750e15c74 065/204: Add ivy integration, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless fb6ad592b7 067/204: List more helpful functions for integration, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless 50c83f2752 074/204: Avoid using cl-lib in autoloads, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless 274c8cbadc 078/204: Declare other ivy variable used, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless b63019aea3 090/204: Add missing (oops!) "forgiving funcall" function, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless 74947d0862 092/204: Update dispatchers documentation, and documents pattern compiler, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless c245cb6e9d 091/204: Make dispatchers always take 3 args (to avoid depending on 26.1),
ELPA Syncer <=
- [elpa] externals/orderless c1be870f02 101/204: Undocument orderless-temporarily-change-separator in README, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless d0b217512f 104/204: Switch to single variable config, add transient vars, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless 5618c349a6 107/204: Remove global dispatchers, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless e56eeef6e1 126/204: Merge pull request #22 from jcs-PR/badge, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless f49a0faceb 128/204: Off by one error in orderless-without-literal, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless ef9bff0020 133/204: Modify readme for better texinfo export, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless ec71107992 138/204: Merge branch 'master' of https://github.com/oantolin/orderless, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless 4844452f4e 139/204: Update documentation, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless 9f18a34d7e 141/204: Revert documentation for #31, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless ea60844b82 151/204: Add missing funcall in decision whether to skip highlighting, ELPA Syncer, 2022/01/11