summaryrefslogtreecommitdiff
path: root/helm-multi-match.el
diff options
context:
space:
mode:
authorThierry Volpiatto <thierry.volpiatto@gmail.com>2016-10-22 11:45:26 +0200
committerThierry Volpiatto <thierry.volpiatto@gmail.com>2016-10-22 11:51:37 +0200
commitb390c5f569b9c8b631d75f7087cc2ac70f60be6f (patch)
tree186f2ac042053e069d2168f4b42b577bfaa8a37e /helm-multi-match.el
parentbb8bf3041318cd5dc557497ba22e670db854495f (diff)
Simplify splitting helm-pattern.
* helm-multi-match.el (helm-mm-space-regexp): Now a defconst. (helm-mm-split-pattern): Remove hack.
Diffstat (limited to 'helm-multi-match.el')
-rw-r--r--helm-multi-match.el15
1 files changed, 5 insertions, 10 deletions
diff --git a/helm-multi-match.el b/helm-multi-match.el
index ce6ed005..383d88a9 100644
--- a/helm-multi-match.el
+++ b/helm-multi-match.el
@@ -63,21 +63,16 @@ when these options are used."
;;; Build regexps
;;
;;
-(defvar helm-mm-space-regexp "[\\ ] "
+(defconst helm-mm-space-regexp "\\s\\\\s-"
"Regexp to represent space itself in multiple regexp match.")
(defun helm-mm-split-pattern (pattern)
"Split PATTERN if it contain spaces and return resulting list.
If spaces in PATTERN are escaped, don't split at this place.
-i.e \"foo bar\"=> (\"foo\" \"bar\")
-but \"foo\ bar\"=> (\"foobar\")."
- (if (string= pattern "")
- '("")
- (cl-loop for s in (split-string
- (replace-regexp-in-string helm-mm-space-regexp
- "\000\000" pattern)
- " " t)
- collect (replace-regexp-in-string "\000\000" " " s))))
+i.e \"foo bar baz\"=> (\"foo\" \"bar\" \"baz\")
+but \"foo\\ bar baz\"=> (\"foo\\s-bar\" \"baz\")."
+ (split-string
+ (replace-regexp-in-string helm-mm-space-regexp "\\\\s-" pattern)))
(defun helm-mm-1-make-regexp (pattern)
"Replace spaces in PATTERN with \"\.*\"."