[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/orderless e3644defcd 088/204: Add orderless-pattern-com
From: |
ELPA Syncer |
Subject: |
[elpa] externals/orderless e3644defcd 088/204: Add orderless-pattern-compiler variable for maximum flexibility |
Date: |
Tue, 11 Jan 2022 12:58:20 -0500 (EST) |
branch: externals/orderless
commit e3644defcdbabfecf9585138bd96ed607f0c5d5b
Author: Omar Antolín <omar.antolin@gmail.com>
Commit: Omar Antolín <omar.antolin@gmail.com>
Add orderless-pattern-compiler variable for maximum flexibility
---
orderless.el | 26 ++++++++++++++++++++------
1 file changed, 20 insertions(+), 6 deletions(-)
diff --git a/orderless.el b/orderless.el
index 5ad3cd3c14..c71c3123f9 100644
--- a/orderless.el
+++ b/orderless.el
@@ -167,6 +167,20 @@ one of the following forms:
:type 'hook
:group 'orderless)
+(defcustom orderless-pattern-compiler #'orderless--component-regexps
+ "The `orderless' pattern compiler.
+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
+`orderless-component-matching-styles' to decide how to match each
+component. See `orderless-style-dispatchers' for details."
+ :type 'function
+ :group 'orderless)
+
(defalias 'orderless-regexp #'identity
"Match a component as a regexp.
This is simply the identity function.")
@@ -271,7 +285,7 @@ For the user's convenience, if REGEXPS is a string, it is
converted to a list of regexps according to the value of
`orderless-component-matching-styles'."
(when (stringp regexps)
- (setq regexps (orderless--component-regexps regexps)))
+ (setq regexps (funcall orderless-pattern-compiler regexps)))
(cl-loop for original in strings
for string = (copy-sequence original)
collect (orderless--highlight regexps string)))
@@ -280,7 +294,7 @@ 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."
+match. See `orderless-style-dispatchers' for details."
(cl-loop
with default = (or orderless-component-matching-styles 'orderless-regexp)
for component in (split-string pattern orderless-component-separator)
@@ -302,8 +316,6 @@ match."
,@(cl-loop for style in styles
collect `(regexp ,(funcall style component)))))))))
-(orderless--component-regexps "osi")
-
(defun orderless--prefix+pattern (string table pred)
"Split STRING into prefix and pattern according to TABLE.
The predicate PRED is used to constrain the entries in TABLE."
@@ -319,7 +331,7 @@ The predicate PRED is used to constrain the entries in
TABLE."
(pcase-let* ((`(,prefix . ,pattern)
(orderless--prefix+pattern string table pred))
(completion-regexp-list
- (orderless--component-regexps pattern)))
+ (funcall orderless-pattern-compiler pattern)))
(all-completions prefix table pred)))
(invalid-regexp nil)))
@@ -392,7 +404,9 @@ This function is part of the `orderless' completion style."
"Convert STR into regexps for use with ivy.
This function is for integration of orderless with ivy, use it as
a value in `ivy-re-builders-alist'."
- (or (mapcar (lambda (x) (cons x t)) (orderless--component-regexps str)) ""))
+ (or (mapcar (lambda (x) (cons x t))
+ (funcall orderless-pattern-compiler str))
+ ""))
(defun orderless-ivy-highlight (str)
"Highlight a match in STR of each regexp in `ivy-regex'.
- [elpa] externals/orderless 0efa87672d 011/204: Fix bug on no matches, (continued)
- [elpa] externals/orderless 0efa87672d 011/204: Fix bug on no matches, ELPA Syncer, 2022/01/11
- [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 <=
- [elpa] externals/orderless 436ef98b16 089/204: Add optional argument for dispatches: total number of components, ELPA Syncer, 2022/01/11
- [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