[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/orderless 7e83e37870 086/204: Fine-tune dispatcher sema
From: |
ELPA Syncer |
Subject: |
[elpa] externals/orderless 7e83e37870 086/204: Fine-tune dispatcher semantics |
Date: |
Tue, 11 Jan 2022 12:58:20 -0500 (EST) |
branch: externals/orderless
commit 7e83e37870c5ea807b03dc04639e2e1199812bb9
Author: Omar Antolín <omar.antolin@gmail.com>
Commit: Omar Antolín <omar.antolin@gmail.com>
Fine-tune dispatcher semantics
Now (nil . str) means replace component with str and use default
matching styles.
This still needs to be documented in the README.
---
orderless.el | 35 +++++++++++++++++++----------------
1 file changed, 19 insertions(+), 16 deletions(-)
diff --git a/orderless.el b/orderless.el
index 8c21ef0308..5ad3cd3c14 100644
--- a/orderless.el
+++ b/orderless.el
@@ -4,7 +4,7 @@
;; Author: Omar Antolín Camarena <omar@matem.unam.mx>
;; Keywords: extensions
-;; Version: 0.3
+;; Version: 0.4
;; Homepage: https://github.com/oantolin/orderless
;; Package-Requires: ((emacs "24.4"))
@@ -145,11 +145,12 @@ 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 nil to indicate the dispatcher will not handle that
-component at that index, or it should return the matching styles
-to use and, if needed, a string to use in place of the
+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).
@@ -157,10 +158,12 @@ return the component stripped of the suffix).
More precisely, the return value of a style dispatcher can be of
one of the following forms:
-- nil,
-- a matching style or non-empty list of matching styles,
-- a `cons' whose `car' is as in the previous case and whose `cdr'
- is a string (to be used in place of the component)."
+- nil
+- a string (to replace the component and continue dispatching),
+- a matching style or non-empty list of matching styles to use,
+- a `cons' whose `car' is either as in the previous case or
+ nil (to request the default matching styles), and whose `cdr'
+ is a string (to replace the component)."
:type 'hook
:group 'orderless)
@@ -279,20 +282,20 @@ Consults `orderless-style-dispatchers' and, if
necessary,`orderless-component-matching-styles' to decide what to
match."
(cl-loop
+ with default = (or orderless-component-matching-styles 'orderless-regexp)
for component in (split-string pattern orderless-component-separator)
and index from 0
for styles = (cl-loop for dispatcher in orderless-style-dispatchers
for result = (funcall dispatcher component index)
- when (stringp result)
+ 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 orderless-component-matching-styles))
- when (and (consp styles) (stringp (cdr styles)))
- ;; dispatcher requested component change
- do (setq component (cdr styles) styles (car styles))
+ finally (return default))
collect
(cond
- ((null styles) component) ;; assume regexp matching if no styles given
((functionp styles) (funcall styles component))
(t (rx-to-string
`(or
- [elpa] externals/orderless 5af63c1217 058/204: Merge remote-tracking branch 'github/master', (continued)
- [elpa] externals/orderless 5af63c1217 058/204: Merge remote-tracking branch 'github/master', ELPA Syncer, 2022/01/11
- [elpa] externals/orderless 60e70aa53b 062/204: Add autoloads, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless b0913a9c56 044/204: Placate checkdoc again, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless f2ccc538ef 061/204: Refactor to provide reusable filtering and highlightinf functions, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless 3b15b2f59d 059/204: Demote Icicles heading, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless 80b53ec38e 019/204: Rename lim to limit, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless 48ec46518a 037/204: Fix typo in README (thanks Juanjo!), ELPA Syncer, 2022/01/11
- [elpa] externals/orderless a21ef6d985 070/204: If matching-styles is nil, assume regexp matching, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless 3c4b4815f0 079/204: Refactor strict initialism functions, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless f30a3e912c 082/204: Initial implementation of style dispatchers, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless 7e83e37870 086/204: Fine-tune dispatcher semantics,
ELPA Syncer <=
- [elpa] externals/orderless 5897841be4 094/204: Rename default pattern compiler, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless 830976770b 102/204: Put integration before related packages in README, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless 68e592055c 113/204: The transient variables should not be customizable, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless 5b292ac136 118/204: Document custom splitter option, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless 1d62307cce 125/204: Add badge., ELPA Syncer, 2022/01/11
- [elpa] externals/orderless cbc0109eac 136/204: Merge pull request #28 from b3n/patch-1, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless d1c0cbf87b 137/204: Add matching style and dispatcher per category overrides (fix #31), ELPA Syncer, 2022/01/11
- [elpa] externals/orderless 5dcf4a6f2b 135/204: Corrected broken link, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless 701b6a07c8 156/204: orderless-try-completions: Remove _metadata argument, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless a609004d5f 159/204: Document that orderless-regexp matches invalid regexps literally, ELPA Syncer, 2022/01/11