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?
To change the read-only status of a buffer, use C-x C-q (toggle read-only-mode ).
Each Emacs window displays one Emacs buffer at any time. A single buffer may appear in more than one window; if it does, any changes in its text are displayed in all the windows where it appears. But the windows showing the same buffer can show different parts of it, because each window has its own value of point.
When Emacs has multiple windows, each window has a chosen buffer which is displayed there, but at any time only one of the windows is selected and its chosen buffer is the selected buffer. Each window's mode line displays the name of the buffer that the window is displaying (see section Multiple Windows).
You can have several buffers open at once, but can edit only one at a time. Several buffers can be visible at the same time when you're splitting your window.
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 *.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With