Skip to content

Commit

Permalink
ivy.el (ivy-switch-buffer-occur): Add
Browse files Browse the repository at this point in the history
Simple occur function for ivy-switch-buffer that drops into a ibuffer
session with the selected buffers filtered.

Fixes abo-abo#438
  • Loading branch information
justbur committed Mar 17, 2016
1 parent 7cf13a7 commit 6a00275
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions ivy.el
Expand Up @@ -2582,6 +2582,13 @@ Skip buffers that match `ivy-ignore-buffers'."
(propertize str 'face 'ivy-modified-buffer)
str)))

(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)))

;;;###autoload
(defun ivy-switch-buffer ()
"Switch to another buffer."
Expand Down Expand Up @@ -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)
(add-text-properties
Expand Down

0 comments on commit 6a00275

Please sign in to comment.