Go to the first, previous, next, last section, table of contents.

Miscellaneous Buffer Operations

C-x C-q
Toggle read-only status of buffer (vc-toggle-read-only).
M-x rename-buffer RET name RET
Change the name of the current buffer.
M-x rename-uniquely
Rename the current buffer by adding `<number>' to the end.
M-x view-buffer RET buffer RET
Scroll through buffer buffer.

A buffer can be read-only, which means that commands to change its contents are not allowed. The mode line indicates read-only buffers with `%%' or `%*' near the left margin. Read-only buffers are usually made by subsystems such as Dired and Rmail that have special commands to operate on the text; also by visiting a file whose access control says you cannot write it.

If you wish to make changes in a read-only buffer, use the command C-x C-q (vc-toggle-read-only). It makes a read-only buffer writable, and makes a writable buffer read-only. In most cases, this works by setting the variable buffer-read-only, which has a local value in each buffer and makes the buffer read-only if its value is non-nil. If the file is maintained with version control, C-x C-q works through the version control system to change the read-only status of the file as well as the buffer. See section Version Control.

M-x rename-buffer changes the name of the current buffer. Specify the new name as a minibuffer argument. There is no default. If you specify a name that is in use for some other buffer, an error happens and no renaming is done.

M-x rename-uniquely renames the current buffer to a similar name with a numeric suffix added to make it both different and unique. This command does not need an argument. It is useful for creating multiple shell buffers: if you rename the `*Shell*' buffer, then do M-x shell again, it makes a new shell buffer named `*Shell*'; meanwhile, the old shell buffer continues to exist under its new name. This method is also good for mail buffers, compilation buffers, and most Emacs features that create special buffers with particular names.

M-x view-buffer is much like M-x view-file (see section Miscellaneous File Operations) except that it examines an already existing Emacs buffer. View mode provides commands for scrolling through the buffer conveniently but not for changing it. When you exit View mode, the value of point that resulted from your perusal remains in effect.

The commands M-x append-to-buffer and M-x insert-buffer can be used to copy text from one buffer to another. See section Accumulating Text.


Go to the first, previous, next, last section, table of contents.