branch: elpa/helm
commit bd22c1e22678e7a748e3e0df4838f41bc5dd1c33
Author: Thierry Volpiatto <thie...@posteo.net>
Commit: Thierry Volpiatto <thie...@posteo.net>

    Fix helm-mm-3f-match so that it use diacritics only on basename
    
    See issue#2470.
    
    Add a function to match on diacritics for helm-mm-3f-match.
---
 helm-multi-match.el | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/helm-multi-match.el b/helm-multi-match.el
index 556eb9cfa9..ca1611e05e 100644
--- a/helm-multi-match.el
+++ b/helm-multi-match.el
@@ -276,7 +276,8 @@ Forward line on empty lines, otherwise goto eol."
 (defun helm-mm-3f-match (candidate &optional pattern)
   "Same as `helm-mm-3-match' but for files or prefix matching.
 Once the first pattern is matched, the subsequent patterns match on the part of
-CANDIDATE starting at end of first match."
+CANDIDATE starting at end of first match.
+Diacritics regexp is never used on the first pattern, the basedir."
   ;; When matching a filename like "/home/you/github/foo-bar.txt" there is no
   ;; problems with `helm-mm-3-match' as long as one of the patterns doesn't
   ;; match the basedir of filename but as soon as you try to match a file with 
a
@@ -291,13 +292,21 @@ CANDIDATE starting at end of first match."
                                (not (helm-mm-regexp-p regexp)))
                           (char-fold-to-regexp regexp)
                         regexp)
-             for pref-re = (if end re (concat "\\`" re))
+             ;; Use `char-fold-to-regexp' on subsequent patterns only.
+             for pref-re = (if end re (concat "\\`" regexp))
              always (funcall predicate
                              (prog1 (condition-case _err
                                         (string-match pref-re candidate end)
                                       (invalid-regexp nil))
                                (unless end
                                  (setq end (match-end 0))))))))
+
+(defun helm-mm-3f-match-on-diacritics (candidate &optional pattern)
+  "Ignore diacritics in basename of files.
+This happens as soon as you enter multi matching i.e. you add space(s) after
+basedir."
+  (let ((helm-mm--match-on-diacritics t))
+    (helm-mm-3f-match candidate (or pattern helm-pattern))))
 
 ;;; multiple regexp pattern 3 with prefix search
 ;;

Reply via email to