emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master 2877ae1 063/272: ivy.el (ivy-ignore-buffers): New defcusto


From: Oleh Krehel
Subject: [elpa] master 2877ae1 063/272: ivy.el (ivy-ignore-buffers): New defcustom
Date: Mon, 25 Apr 2016 10:13:16 +0000

branch: master
commit 2877ae13fac87a8c62e88c7ec82ca2f9faca21f8
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>

    ivy.el (ivy-ignore-buffers): New defcustom
    
    * ivy.el (ivy--buffer-list): Use `ivy-ignore-buffers'.
    
    Fixes #366
---
 ivy.el |   34 ++++++++++++++++++++++------------
 1 file changed, 22 insertions(+), 12 deletions(-)

diff --git a/ivy.el b/ivy.el
index 911fede..7a3a07c 100644
--- a/ivy.el
+++ b/ivy.el
@@ -2285,21 +2285,31 @@ 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))
+
 (defun ivy--buffer-list (str &optional virtual)
   "Return the buffers that match STR.
 When VIRTUAL is non-nil, add virtual buffers."
-  (delete-dups
-   (append
-    (mapcar
-     (lambda (x)
-       (if (with-current-buffer x
-             (file-remote-p
-              (abbreviate-file-name default-directory)))
-           (propertize x 'face 'ivy-remote)
-         x))
-     (all-completions str 'internal-complete-buffer))
-    (and virtual
-         (ivy--virtual-buffers)))))
+  (cl-remove-if
+   (lambda (buf)
+     (cl-find-if
+      (lambda (regexp)
+        (string-match regexp buf))
+      ivy-ignore-buffers))
+   (delete-dups
+    (append
+     (mapcar
+      (lambda (x)
+        (if (with-current-buffer x
+              (file-remote-p
+               (abbreviate-file-name default-directory)))
+            (propertize x 'face 'ivy-remote)
+          x))
+      (all-completions str 'internal-complete-buffer))
+     (and virtual
+          (ivy--virtual-buffers))))))
 
 (defun ivy--switch-buffer-action (buffer)
   "Switch to BUFFER.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]