]> code.delx.au - gnu-emacs-elpa/commitdiff
Make ivy-ignore-buffers similar to ido-ignore-buffers.
authorConstantin Kulikov <zxnotdead@gmail.com>
Tue, 9 Feb 2016 09:31:24 +0000 (12:31 +0300)
committerOleh Krehel <ohwoeowho@gmail.com>
Mon, 21 Mar 2016 09:30:40 +0000 (10:30 +0100)
Fixes #382

ivy.el

diff --git a/ivy.el b/ivy.el
index a9738dcb578b7eb782671cf98300f84797e4a483..76a4f58556c4bbc7f382f46bf968a2439a30d6a0 100644 (file)
--- a/ivy.el
+++ b/ivy.el
@@ -2485,9 +2485,9 @@ CANDS is a list of strings."
       (setq ivy--virtual-buffers (nreverse virtual-buffers))
       (mapcar #'car ivy--virtual-buffers))))
 
-(defcustom ivy-ignore-buffers nil
-  "List of regexps matching buffer names to ignore."
-  :type '(repeat regexp))
+(defcustom ivy-ignore-buffers '("\\` ")
+  "List of regexps or functions matching buffer names to ignore."
+  :type '(repeat (choice regexp function)))
 
 (defun ivy--buffer-list (str &optional virtual)
   "Return the buffers that match STR.
@@ -2562,8 +2562,10 @@ Skip buffers that match `ivy-ignore-buffers'."
       (or (cl-remove-if
            (lambda (buf)
              (cl-find-if
-              (lambda (regexp)
-                (string-match regexp buf))
+              (lambda (f-or-r)
+                (if (functionp f-or-r)
+                    (funcall ff buf)
+                  (string-match-p f-or-r buf)))
               ivy-ignore-buffers))
            res)
           res))))