Emacs: List Buffers
This page is a tutorial on managing buffers in emacs.
In emacs, every file is shown in a “buffer”. (You can think of “buffer” as opened file or tabbed window without the tab. It's called buffer because back in 1980s, emacs can only display parts of a file.)
- Alt+x
list-buffers
【Ctrl+x Ctrl+b】 - List buffers.
- Alt+x
ibuffer
- Improved version of list buffers. It colors the files by type.
- Alt+x
kill-buffer
【Ctrl+x k】 - Close the current buffer.


Make ibuffer Default
To make ibuffer
default, put the following in your init file:
(defalias 'list-buffers 'ibuffer) ; make ibuffer default
Batch Operation on Buffers
You can do operation in batch to the marked ones. Example:
- Save all unsaved files
- Close all files of a given dir
- Close all Java files
Here's most useful ibuffer
commands.
- m → Mark
- u → Unmark
- * u → Mark unsaved
- S → Save marked buffer
- D → Close marked buffers
While in ibuffer, Alt+x describe-mode
to see a full list of ibuffer commands.