[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/orderless 436ef98b16 089/204: Add optional argument for
From: |
ELPA Syncer |
Subject: |
[elpa] externals/orderless 436ef98b16 089/204: Add optional argument for dispatches: total number of components |
Date: |
Tue, 11 Jan 2022 12:58:20 -0500 (EST) |
branch: externals/orderless
commit 436ef98b16e69bd296056b3b1202a7f2914c18a0
Author: Omar Antolín <omar.antolin@gmail.com>
Commit: Omar Antolín <omar.antolin@gmail.com>
Add optional argument for dispatches: total number of components
---
orderless.el | 42 ++++++++++++++++++++++++------------------
1 file changed, 24 insertions(+), 18 deletions(-)
diff --git a/orderless.el b/orderless.el
index c71c3123f9..ead96ea972 100644
--- a/orderless.el
+++ b/orderless.el
@@ -144,16 +144,18 @@ variable one at a time until one handles the component
(details
below). If no dispatcher handles the component, the matching
styles in `orderless-component-matching-styles' are applied.
-A style dispatcher is a function of two arguments, a string and
-an integer. It is called with each component of the input string
-and the component's index (starting from 0). 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 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).
More precisely, the return value of a style dispatcher can be of
one of the following forms:
@@ -173,11 +175,11 @@ This should be a function that takes an input pattern and
returns
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 splits the input on
-`orderless-component-separator', and consults both
-`orderless-style-dispatchers' and
+The default pattern compiler is probably flexible enough for most
+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)
@@ -294,13 +296,17 @@ converted to a list of regexps according to the value of
"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."
+match. See `orderless-style-dispatchers' for details.
+
+This is the default value of `orderless-pattern-compiler'."
(cl-loop
with default = (or orderless-component-matching-styles 'orderless-regexp)
- for component in (split-string pattern orderless-component-separator)
- and index from 0
+ 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 = (funcall dispatcher component index)
+ 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)))
- [elpa] externals/orderless acc2645cf3 030/204: Even better match faces (kindly contributed by Protesilaos), (continued)
- [elpa] externals/orderless acc2645cf3 030/204: Even better match faces (kindly contributed by Protesilaos), ELPA Syncer, 2022/01/11
- [elpa] externals/orderless 6ada0ad21c 035/204: Add docstrings to functions, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless a371c26c69 003/204: Stronger wording for warning, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless d576dc9fac 028/204: Add reminder that match faces only are used if orderless "wins", ELPA Syncer, 2022/01/11
- [elpa] externals/orderless 6aabc83f02 022/204: Remove warning and stuff about SPC, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless 1ad6bd254b 021/204: Only copy and highlight once the candidate is known to match, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless f2af44bf2e 057/204: Mention Icicles's progressive matching, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless 1631eb1733 073/204: Fix autoload for ivy, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless 862eed345c 075/204: Add more orderless initialism styles, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless e3644defcd 088/204: Add orderless-pattern-compiler variable for maximum flexibility, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless 436ef98b16 089/204: Add optional argument for dispatches: total number of components,
ELPA Syncer <=
- [elpa] externals/orderless ed37c22902 097/204: Prefer descriptive argument over "mystery t's", ELPA Syncer, 2022/01/11
- [elpa] externals/orderless 9cebf2fc8c 106/204: Escape parenthesis in first column of docstrings, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless 93f4bccea1 112/204: Go back to split-string until empty components issue is resolved, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless 2d1f68b914 114/204: Fix tiny bug in customization type, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless 5c2f44d901 115/204: Allow component separator to be a function, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless 43896f3e10 140/204: Accidentally omitted the overview! Bring it back, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless b059c15911 052/204: Make orderless-prefixes more like partial-completion, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless dc3f8da022 076/204: Avoid other cl-pushnes in an autoload, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless a11302737e 018/204: Keep split-string from modifying global match data, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless c9ae65ea16 023/204: Highlight component matches in one of four faces, ELPA Syncer, 2022/01/11