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

    Simplify helm-mm-prefix-match
    
    Previously we were using equality on pattern and the leading common
    part of candidate and pattern, also we had to maybe unquote pattern to
    handle (Bug#1283).
---
 helm-multi-match.el | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/helm-multi-match.el b/helm-multi-match.el
index 7556da1efb..f5fa27b29d 100644
--- a/helm-multi-match.el
+++ b/helm-multi-match.el
@@ -127,13 +127,11 @@ If GREP-SPACE is used translate escaped space to \"\\s\" 
instead of \"\\s-\"."
   helm-mm--prefix-pattern-real)
 
 (defun helm-mm-prefix-match (candidate &optional pattern)
-  ;; In filename completion basename and basedir may be
-  ;; quoted, unquote them for string comparison (Bug#1283).
-  (setq pattern (replace-regexp-in-string
-                 "\\\\" "" (or pattern helm-pattern)))
-  (let ((len (length pattern)))
-    (and (<= len (length candidate))
-         (string= (substring candidate 0 len) pattern ))))
+  ;; Previously we were using equality on pattern and the leading common part 
of
+  ;; candidate and pattern, also we had to maybe unquote pattern to handle
+  ;; (Bug#1283), matching unconditionally if pattern match at start of 
candidate
+  ;; seems simpler.
+  (string-match (concat "\\`" pattern) candidate))
 
 (defun helm-mm-prefix-search (pattern &rest _ignore)
   (search-forward (helm-mm-prefix-get-pattern pattern) nil t))

Reply via email to