]> code.delx.au - gnu-emacs-elpa/commitdiff
Warn the user about the behavior of ivy--regex-ignore-order
authorSamuel Loury <konubinixweb@gmail.com>
Tue, 24 Nov 2015 07:29:04 +0000 (08:29 +0100)
committerOleh Krehel <ohwoeowho@gmail.com>
Tue, 24 Nov 2015 11:08:03 +0000 (12:08 +0100)
Fixes #296
Fixes #305

ivy.el

diff --git a/ivy.el b/ivy.el
index 19fc0e9ccfba9a0b8fd2e4ee3b87be1eff5f99db..050f4602784cbc35f02166c83f93bc20f99de66a 100644 (file)
--- a/ivy.el
+++ b/ivy.el
@@ -1382,7 +1382,16 @@ When GREEDY is non-nil, join words in a greedy way."
 
 (defun ivy--regex-ignore-order (str)
   "Re-build regex from STR by splitting it on spaces.
-Ignore the order of each group."
+Ignore the order of each group.
+
+ATTENTION: This is a proof of concept and may not work as you
+expect. It will match as many groups as there are in the STR, but
+won't make sure that the matches are distinct. For instance, if
+you type 'foo bar', anything that contains 'foo' and 'bar', 'bar'
+and 'foo' will be matched, but also anything that contains 'foo'
+twice or 'bar' twice. If you want to find all candidates containing 'foo' and
+'bar' in any order, consider using `ivy-restrict-to-matches' instead.
+"
   (let* ((subs (split-string str " +" t))
          (len (length subs)))
     (cl-case len