Previous: , Up: Buffers   [Contents][Index]


15.5 Operating on Several Buffers

The buffer-menu facility is like a “Dired for buffers”; it allows you to request operations on various Emacs buffers by editing a buffer containing a list of them. You can save buffers, kill them (here called deleting them, for consistency with Dired), or display them.

M-x buffer-menu

Begin editing a buffer listing all Emacs buffers.

The command buffer-menu writes a list of all Emacs buffers into the buffer ‘*Buffer List*’, and selects that buffer in Buffer Menu mode. The buffer is read-only. You can only change it using the special commands described in this section. Most of the commands are graphic characters. You can use Emacs cursor motion commands in the ‘*Buffer List*’ buffer. If the cursor is on a line describing a buffer, the following special commands apply to that buffer:

d

Request to delete (kill) the buffer, then move down. A ‘D’ before the buffer name on a line indicates a deletion request. Requested deletions actually take place when you use the x command.

k

Synonym for d.

C-d

Like d but move up afterwards instead of down.

s

Request to save the buffer. An ‘S’ before the buffer name on a line indicates the request. Requested saves actually take place when you use the x command. You can request both saving and deletion for the same buffer.

~

Mark buffer “unmodified”. The command ~ does this immediately when typed.

x

Perform previously requested deletions and saves.

u

Remove any request made for the current line, and move down.

DEL

Move to previous line and remove any request made for that line.

All commands that add or remove flags to request later operations also move down a line. They accept a numeric argument as a repeat count, unless otherwise specified.

There are also special commands to use the buffer list to select another buffer, and to specify one or more other buffers for display in additional windows.

1

Select the buffer in a full-frame window. This command takes effect immediately.

2

Immediately set up two windows, with this buffer in one and the buffer selected before ‘*Buffer List*’ in the other.

f

Immediately select the buffer in place of the ‘*Buffer List*’ buffer.

o

Immediately select the buffer in another window as if by C-x 4 b, leaving ‘*Buffer List*’ visible.

q

Immediately select this buffer, and display any buffers previously flagged with the m command in other windows. If there are no buffers flagged with m, this command is equivalent to 1.

m

Flag this buffer to be displayed in another window if the q command is used. The request shows as a ‘>’ at the beginning of the line. The same buffer may not have both a delete request and a display request.

Going back between a buffer-menu buffer and other Emacs buffers is easy. You can, for example, switch from the ‘*Buffer List*’ buffer to another Emacs buffer, and edit there. You can then reselect the buffer-menu buffer and perform operations already requested, or you can kill that buffer or pay no further attention to it. All that buffer-menu does directly is create and select a suitable buffer, and turn on Buffer Menu mode. All the other capabilities of the buffer menu are implemented by special commands provided in Buffer Menu mode.

The only difference between buffer-menu and list-buffers is that buffer-menu selects the ‘*Buffer List*’ buffer and list-buffers does not. If you run list-buffers (that is, type C-x C-b) and select the buffer list manually, you can use all the commands described here.


Previous: , Up: Buffers   [Contents][Index]