Skip to content

Commit a9bca00

Browse files
Simplify helm-boring-file-regexp-list settings (#2009)
1 parent ae0327e commit a9bca00

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

helm-lib.el

+9-11
Original file line numberDiff line numberDiff line change
@@ -114,28 +114,26 @@ convenient to use a simple boolean value here."
114114
(defun helm-ff--setup-boring-regex (var val)
115115
(set var val)
116116
(setq helm-ff--boring-regexp
117-
(cl-loop with last = (car (last val))
118-
for r in (butlast val)
119-
if (string-match "\\$\\'" r)
120-
concat (concat r "\\|") into result
121-
else concat (concat r "$\\|") into result
122-
finally return
123-
(concat result last
124-
(if (string-match "\\$\\'" last) "" "$")))))
117+
(cl-loop for r on val
118+
if (cdr r)
119+
concat (concat (car r) "\\|")
120+
else concat (car r))))
125121

126122
(defcustom helm-boring-file-regexp-list
127123
(mapcar (lambda (f)
128124
(let ((rgx (regexp-quote f)))
129125
(if (string-match-p "[^/]$" f)
130126
;; files: e.g .o => \\.o$
131127
(concat rgx "$")
132-
;; directories: e.g .git/ => \.git\\(/\\|$\\)
133-
(concat (substring rgx 0 -1) "\\(/\\|$\\)"))))
128+
;; To not ignore files with same prefix as directory names
129+
;; (bug#2009) use e.g. .git/ => \.git\?$.
130+
;; See also PR in bug#2012.
131+
(concat rgx "?$"))))
134132
completion-ignored-extensions)
135133
"A list of regexps matching boring files.
136134
137135
This list is build by default on `completion-ignored-extensions'.
138-
The directory names should end with \"/?\" e.g. \"\\.git/?\" and
136+
The directory names should end with \"/?$\" e.g. \"\\.git/?$\" and
139137
the file names should end with \"$\" e.g. \"\\.o$\".
140138
141139
These regexps may be used to match the entire path, not just the

0 commit comments

Comments
 (0)