[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/orderless 5c2f44d901 115/204: Allow component separator
From: |
ELPA Syncer |
Subject: |
[elpa] externals/orderless 5c2f44d901 115/204: Allow component separator to be a function |
Date: |
Tue, 11 Jan 2022 12:58:22 -0500 (EST) |
branch: externals/orderless
commit 5c2f44d90130c5e03ecd1bf290b7287745c4f0fd
Author: Omar Antolín <omar.antolin@gmail.com>
Commit: Omar Antolín <omar.antolin@gmail.com>
Allow component separator to be a function
---
orderless.el | 27 +++++++++++++++++++--------
1 file changed, 19 insertions(+), 8 deletions(-)
diff --git a/orderless.el b/orderless.el
index 8ef4b07fe9..0255a1faca 100644
--- a/orderless.el
+++ b/orderless.el
@@ -91,12 +91,16 @@
:group 'orderless)
(defcustom orderless-component-separator " +"
- "Regexp to match component separators for orderless completion.
-This is passed to `split-string' to divide the pattern into
-component regexps."
+ "Component separators for orderless completion.
+This can either be a string, which is passed to `split-string',
+or a function of a single string argument."
:type '(choice (const :tag "Spaces" " +")
(const :tag "Spaces, hyphen or slash" " +\\|[-/]")
- (regexp :tag "Custom regexp"))
+ (const :tag "Escapable space"
+ orderless-escapeable-split-on-space)
+ (const :tag "Quotable spaces" split-string-and-unquote)
+ (regexp :tag "Custom regexp")
+ (function : tag "Custom function"))
:group 'orderless)
(defvar-local orderless-transient-component-separator nil
@@ -323,6 +327,12 @@ converted to a list of regexps according to the value of
;;; Compiling patterns to lists of regexps
+(defun orderless-escapeable-split-on-space (string)
+ "Split STRING on spaces, which can be escaped with backslash."
+ (mapcar
+ (lambda (piece) (replace-regexp-in-string (string 0) " " piece))
+ (split-string (replace-regexp-in-string "\\\\ " (string 0) string) " ")))
+
(defun orderless-remove-transient-configuration ()
"Remove all transient orderless configuration.
Meant to be added to `exit-minibuffer-hook'."
@@ -400,10 +410,11 @@ compilers."
(unless dispatchers (setq dispatchers orderless-style-dispatchers))
(setq dispatchers (or orderless-transient-style-dispatchers dispatchers))
(cl-loop
- with components = (split-string
- pattern
- (or orderless-transient-component-separator
- orderless-component-separator))
+ with splitter = (or orderless-transient-component-separator
+ orderless-component-separator)
+ with components = (if (functionp splitter)
+ (funcall splitter pattern)
+ (split-string pattern splitter))
with total = (length components)
for component in components and index from 0
for (newstyles . newcomp) = (orderless-dispatch
- [elpa] externals/orderless 1ad6bd254b 021/204: Only copy and highlight once the candidate is known to match, (continued)
- [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, 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 <=
- [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
- [elpa] externals/orderless 044fac0859 029/204: Revert "Better match face defaults (kindly contributed by Protesilaos)", ELPA Syncer, 2022/01/11
- [elpa] externals/orderless 2813ffb2b1 039/204: Optimization: check if first component is string literal, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless 25266dfc60 033/204: Update README.org, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless 39202177e1 040/204: Undo previous optimization as it is invalid in general :(, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless ecddc3da2e 045/204: Un-nest definition of orderless--highlight-matches, ELPA Syncer, 2022/01/11