]> code.delx.au - gnu-emacs-elpa/commitdiff
Modified ivy to pass predicate when selecting buffers
authorIan Dunn <scholar42@gmail.com>
Tue, 5 Apr 2016 13:02:58 +0000 (09:02 -0400)
committerIan Dunn <scholar42@gmail.com>
Tue, 5 Apr 2016 13:02:58 +0000 (09:02 -0400)
* ivy.el (ivy--buffer-list): Add PREDICATE parameter and pass to
  'all-completions'
(ivy--reset-state): Pass predicate parameter to 'ivy--buffer-list'.

This allows 'read-buffer' to filter the buffers with the PREDICATE parameter.

ivy.el

diff --git a/ivy.el b/ivy.el
index 8d25e28f6d478f82b3c1c5981c40c096fae603fc..415f54a6892277cc0f67b66b4253b007c1b642ee 100644 (file)
--- a/ivy.el
+++ b/ivy.el
@@ -1410,7 +1410,7 @@ This is useful for recursive `ivy-read'."
                             (not (equal (ivy--get-action ivy-last) 'identity)))
                  (setq initial-input nil))))
             ((eq collection 'internal-complete-buffer)
-             (setq coll (ivy--buffer-list "" ivy-use-virtual-buffers)))
+             (setq coll (ivy--buffer-list "" ivy-use-virtual-buffers predicate)))
             (dynamic-collection
              (setq coll (funcall collection ivy-text)))
             ((or (functionp collection)
@@ -2508,7 +2508,7 @@ CANDS is a list of strings."
   "List of regexps or functions matching buffer names to ignore."
   :type '(repeat (choice regexp function)))
 
-(defun ivy--buffer-list (str &optional virtual)
+(defun ivy--buffer-list (str &optional virtual predicate)
   "Return the buffers that match STR.
 When VIRTUAL is non-nil, add virtual buffers."
   (delete-dups
@@ -2520,7 +2520,7 @@ When VIRTUAL is non-nil, add virtual buffers."
               (abbreviate-file-name default-directory)))
            (propertize x 'face 'ivy-remote)
          x))
-     (all-completions str 'internal-complete-buffer))
+     (all-completions str 'internal-complete-buffer predicate))
     (and virtual
          (ivy--virtual-buffers)))))