Reputation: 11904
I use buffer-menu extensively to switch between buffers. I want to list the buffers which are files or dired. How can I do that?
Upvotes: 7
Views: 2083
Reputation: 21192
You can use ibuffer
There you can define your buffer groups. You can mark buffers, use filtering and sorting, do search/replace in marked buffers and other useful stuff.
For your case just put into the hook (ibuffer-filter-by-filename ".")
Here is an example from my .emacs .
(require 'ibuffer)
(setq ibuffer-saved-filter-groups
(quote (("default"
("dired" (mode . dired-mode))
("java" (mode . java-mode))
("org" (mode . org-mode))
("sql" (mode . sql-mode))
("xml" (mode . nxml-mode))))))
(setq ibuffer-show-empty-filter-groups nil)
(add-hook 'ibuffer-mode-hook
(lambda ()
(ibuffer-switch-to-saved-filter-groups "default")
(ibuffer-filter-by-filename "."))) ;; to show only dired and files buffers
EDIT. If you want to filter out temporary buffers (which name begins with *) you can set the following filter (regex)
(ibuffer-filter-by-name "^[^*]")
It says that the buffer name should start with any character except *.
Upvotes: 6
Reputation: 30718
Buffer Menu+ has what you want. It treats Dired buffers like file buffers, so when you use C-u C-x C-b (either list-buffers
or buffer-menu
) you get only Dired and file buffers.
Upvotes: 2
Reputation: 13452
Calling buffer-menu
with a prefix argument (C-u M-x buffer-menu
) will list only buffers which are visiting files. Unfortunately I can't see an easy way to include dired in that list.
Upvotes: 0