[Top][All Lists]

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

[elpa] master 6a00275 187/272: ivy.el (ivy-switch-buffer-occur): Add

From: Oleh Krehel
Subject: [elpa] master 6a00275 187/272: ivy.el (ivy-switch-buffer-occur): Add
Date: Mon, 25 Apr 2016 10:13:24 +0000

branch: master
commit 6a0027502e61538a1ece86904e7377d0368fa108
Author: justbur <address@hidden>
Commit: justbur <address@hidden>

    ivy.el (ivy-switch-buffer-occur): Add
    Simple occur function for ivy-switch-buffer that drops into a ibuffer
    session with the selected buffers filtered.
    Fixes #438
 ivy.el |   10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/ivy.el b/ivy.el
index b5a8d08..2148880 100644
--- a/ivy.el
+++ b/ivy.el
@@ -2582,6 +2582,13 @@ Skip buffers that match `ivy-ignore-buffers'."
         (propertize str 'face 'ivy-modified-buffer)
+(defun ivy-switch-buffer-occur ()
+  "Occur function for `ivy-switch-buffer' that uses `ibuffer'."
+  (let* ((cand-regexp
+          (concat "\\(" (mapconcat #'regexp-quote ivy--old-cands "\\|") "\\)"))
+         (new-qualifier `((name . ,cand-regexp))))
+    (ibuffer nil (buffer-name) new-qualifier)))
 (defun ivy-switch-buffer ()
   "Switch to another buffer."
@@ -2756,6 +2763,9 @@ When `ivy-calling' isn't nil, call `ivy-occur-press'."
   (setq ivy--occurs-list
         (plist-put ivy--occurs-list cmd occur)))
+(ivy-set-occur 'ivy-switch-buffer 'ivy-switch-buffer-occur)
+(ivy-set-occur 'ivy-switch-buffer-other-window 'ivy-switch-buffer-occur)
 (defun ivy--occur-insert-lines (cands)
   (dolist (str cands)

reply via email to

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