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

    Simplify helm-boring-file-regexp-list settings (#2009)
---
 helm-lib.el | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/helm-lib.el b/helm-lib.el
index 5cf116809c..e31bf737f8 100644
--- a/helm-lib.el
+++ b/helm-lib.el
@@ -114,14 +114,10 @@ convenient to use a simple boolean value here."
 (defun helm-ff--setup-boring-regex (var val)
   (set var val)
   (setq helm-ff--boring-regexp
-          (cl-loop with last = (car (last val))
-                   for r in (butlast val)
-                   if (string-match "\\$\\'" r)
-                   concat (concat r "\\|") into result
-                   else concat (concat r "$\\|") into result
-                   finally return
-                   (concat result last
-                           (if (string-match "\\$\\'" last) "" "$")))))
+        (cl-loop for r on val
+                 if (cdr r)
+                 concat (concat (car r) "\\|")
+                 else concat (car r))))
 
 (defcustom helm-boring-file-regexp-list
   (mapcar (lambda (f)
@@ -129,13 +125,15 @@ convenient to use a simple boolean value here."
               (if (string-match-p "[^/]$" f)
                   ;; files: e.g .o => \\.o$
                   (concat rgx "$")
-                ;; directories: e.g .git/ => \.git\\(/\\|$\\)
-                (concat (substring rgx 0 -1) "\\(/\\|$\\)"))))
+                ;; To not ignore files with same prefix as directory names
+                ;; (bug#2009) use e.g. .git/ => \.git\?$.
+                ;; See also PR in bug#2012.
+                (concat rgx "?$"))))
           completion-ignored-extensions)
   "A list of regexps matching boring files.
 
 This list is build by default on `completion-ignored-extensions'.
-The directory names should end with \"/?\" e.g. \"\\.git/?\" and
+The directory names should end with \"/?$\" e.g. \"\\.git/?$\" and
 the file names should end with \"$\" e.g. \"\\.o$\".
 
 These regexps may be used to match the entire path, not just the

Reply via email to