summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Mendler <mail@daniel-mendler.de>2021-08-10 15:18:20 +0200
committerDaniel Mendler <mail@daniel-mendler.de>2021-08-10 15:18:49 +0200
commit268e56d436ef66c8d9630482cb4dae1e7ff44ee4 (patch)
tree4fe09e759dac37e933fdc2ae64a9c5999837a533
parent3f76b7d1a198627c4f69c378b504afbda03145e8 (diff)
Fix orderless-escapable-split-on-space
* Currently escaped backslash also escapes space * Allocate match-data only once
-rw-r--r--orderless.el8
1 files changed, 6 insertions, 2 deletions
diff --git a/orderless.el b/orderless.el
index b3b7688..d332c7a 100644
--- a/orderless.el
+++ b/orderless.el
@@ -276,7 +276,7 @@ at a word boundary in the candidate. This is similar to the
for regexp in regexps and i from 0
when (string-match regexp string) do
(cl-loop
- for (x y) on (or (cddr (match-data)) (match-data)) by #'cddr
+ for (x y) on (let ((m (match-data))) (or (cddr m) m)) by #'cddr
when x do
(add-face-text-property
x y
@@ -302,7 +302,11 @@ converted to a list of regexps according to the value of
"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) " ")))
+ (split-string (replace-regexp-in-string
+ "\\\\\\\\\\|\\\\ "
+ (lambda (x) (if (equal x "\\ ") (string 0) x))
+ string)
+ " +" t)))
(defun orderless-dispatch (dispatchers default string &rest args)
"Run DISPATCHERS to compute matching styles for STRING.