Skip to content

Commit

Permalink
* helm-buffers.el (helm-c-boring-buffer-regexp-list): New, replacemen…
Browse files Browse the repository at this point in the history
…t for helm-c-boring-buffer-regexp for skipping.

(helm-buffers-skip-entries): New, handle a list of regexp.
(helm-c-skip-boring-buffers): Use it.
* helm-utils (helm-c-shadow-entries): Use when.
  • Loading branch information
Thierry Volpiatto committed May 5, 2012
1 parent 7fac441 commit 80c34cb
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 8 deletions.
27 changes: 21 additions & 6 deletions helm-buffers.el
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,21 @@
;; echo area
" *Echo Area" " *Minibuf"))
"The regexp that match boring buffers.
Buffer candidates matching this regular expression will be
filtered from the list of candidates if the
`helm-c-skip-boring-buffers' candidate transformer is used, or
they will be displayed with face `file-name-shadow' if
Buffer candidates matching this regular expression will be displayed
with face `file-name-shadow' if
`helm-c-shadow-boring-buffers' is used."
:type 'string
:group 'helm-buffers)

(defcustom helm-c-boring-buffer-regexp-list
'("\\` " "\\*helm" "\\*helm-mode" "\\*Echo Area" "\\*Minibuf")
"The regexp list that match boring buffers.
Buffer candidates matching these regular expression will be
filtered from the list of candidates if the
`helm-c-skip-boring-buffers' candidate transformer is used."
:type 'list
:group 'helm-buffers)

(defcustom helm-buffers-favorite-modes '(lisp-interaction-mode
emacs-lisp-mode
text-mode
Expand Down Expand Up @@ -387,9 +394,17 @@ See `helm-ediff-marked-buffers'."
;;; Candidate Transformers
;;
;;
;;; Buffers

(defun helm-buffers-skip-entries (seq regexp-list)
"Remove entries which matches REGEXP from SEQ."
(loop for i in seq
unless (loop for regexp in regexp-list
thereis (and (stringp i)
(string-match regexp i)))
collect i))

(defun helm-c-skip-boring-buffers (buffers)
(helm-c-skip-entries buffers helm-c-boring-buffer-regexp))
(helm-buffers-skip-entries buffers helm-c-boring-buffer-regexp-list))

(defun helm-c-shadow-boring-buffers (buffers)
"Buffers matching `helm-c-boring-buffer-regexp' will be
Expand Down
4 changes: 2 additions & 2 deletions helm-utils.el
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,8 @@ The match is done with `string-match'."
'file-name-shadow
;; fall back to default on XEmacs
'default)))
(if (string-match regexp file)
(setq file (propertize file 'face face))))
(when (string-match regexp file)
(setq file (propertize file 'face face))))
file)
list))

Expand Down

0 comments on commit 80c34cb

Please sign in to comment.