Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Next: , Previous: Kill Buffer, Up: Buffers


24.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 an Emacs 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.
M-x buffer-menu-other-window.
Similar, but do it in another window.

The command buffer-menu writes a list of all Emacs buffers1 into the buffer ‘*Buffer List*’, and selects that buffer in Buffer Menu mode.

The buffer is read-only, and can be changed only through the special commands described in this section. The usual Emacs cursor motion commands can be used in the ‘*Buffer List*’ buffer. The following commands apply to the buffer described on the current line.

d
Request to delete (kill) the buffer, then move down. The request shows as a ‘D’ on the line, before the buffer name. Requested deletions take place when you type the x command.
C-d
Like d but move up afterwards instead of down.
s
Request to save the buffer. The request shows as an ‘S’ on the line. Requested saves take place when you type the x command. You may request both saving and deletion for the same buffer.
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.

The d, C-d, s and u commands to add or remove flags also move down (or up) one line. They accept a numeric argument as a repeat count.

These commands operate immediately on the buffer listed on the current line:

~
Mark the buffer “unmodified.” The command ~ does this immediately when you type it.
%
Toggle the buffer's read-only flag. The command % does this immediately when you type it.
t
Visit the buffer as a tags table. See Select Tags Table.

There are also commands to select another buffer or buffers:

q
Quit the buffer menu—immediately display the most recent formerly visible buffer in its place.
<RET>
f
Immediately select this line's buffer in place of the ‘*Buffer List*’ buffer.
o
Immediately select this line's buffer in another window as if by C-x 4 b, leaving ‘*Buffer List*’ visible.
C-o
Immediately display this line's buffer in another window, but don't select the window.
1
Immediately select this line's buffer in a full-screen window.
2
Immediately set up two windows, with this line's buffer selected in one, and the previously current buffer (aside from the buffer ‘*Buffer List*’) displayed in the other.
b
Bury the buffer listed on this line.
m
Mark this line's buffer to be displayed in another window if you exit with the v command. The request shows as a ‘>’ at the beginning of the line. (A single buffer may not have both a delete request and a display request.)
v
Immediately select this line's buffer, and also display in other windows any buffers previously marked with the m command. If you have not marked any buffers, this command is equivalent to 1.

There is also a command that affects the entire buffer list:

T
Delete, or reinsert, lines for non-file buffers. This command toggles the inclusion of such buffers in the buffer list.

What buffer-menu actually does is create and switch to a suitable buffer, and turn on Buffer Menu mode in it. Everything else described above is implemented by the special commands provided in Buffer Menu mode. One consequence of this is that you can switch from the ‘*Buffer List*’ buffer to another Emacs buffer, and edit there. You can reselect the ‘*Buffer List*’ buffer later, to perform the operations already requested, or you can kill it, or pay no further attention to it.

The list in the ‘*Buffer List*’ buffer looks exactly like the buffer list described in List Buffers, because they really are the same. The only difference between buffer-menu and list-buffers is that buffer-menu switches to the ‘*Buffer List*’ buffer in the selected window; list-buffers displays the same buffer in another window. If you run list-buffers (that is, type C-x C-b) and select the buffer list manually, you can use all of the commands described here.

Normally, the buffer ‘*Buffer List*’ is not updated automatically when buffers are created and killed; its contents are just text. If you have created, deleted or renamed buffers, the way to update ‘*Buffer List*’ to show what you have done is to type g (revert-buffer) or repeat the buffer-menu command.

The ‘*Buffer List*’ buffer does automatically update every auto-revert-interval seconds if you enable Auto Revert mode in it. (As long as it is not marked modified.) Global Auto Revert mode does not update the ‘*Buffer List*’ buffer by default, but it does if global-auto-revert-non-file-buffers is non-nil. see Autorevert, for details.

The command buffer-menu-other-window works the same as buffer-menu, except that it displays the buffers list in another window.


Footnotes

[1] Buffers which don't visit files and whose names begin with a space are omitted: these are used internally by Emacs.



 
 
  Published under the terms of the GNU General Public License Design by Interspire