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.)
- List buffers.
- Improved version of list buffers. It colors the files by type.
- Close the current buffer.
Make ibuffer Default
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
- m → Mark
- u → Unmark
- * u → Mark unsaved
- S → Save marked buffer
- D → Close marked buffers
ibuffer, the key sequence * u S D
will save all unsaved files and close them. This is particularly useful
after you've done a find replace on hundreds of files with
[see Emacs: Find Replace Text in Directory]
While in ibuffer, Alt+x
describe-mode to see a full list of ibuffer commands.