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


15.3 Miscellaneous Buffer Operations

C-x C-q

Toggle read-only status of buffer (toggle-read-only).

M-x rename-buffer

Change the name of the current buffer.

M-x view-buffer

Scroll through a buffer.

A buffer can be read-only, which means that commands to change its text are not allowed. Normally, read-only buffers are created by subsystems such as Dired and Rmail that have special commands to operate on the text. Emacs also creates a read-only buffer if you visit a file that is protected. To make changes in a read-only buffer, use the command C-x C-q (toggle-read-only). It makes a read-only buffer writable, and makes a writable buffer read-only. This works by setting the variable buffer-read-only, which has a local value in each buffer and makes a buffer read-only if its value is non-nil.

M-x rename-buffer changes the name of the current buffer, prompting for the new name in the minibuffer. There is no default. If you specify a name that is used by a different buffer, an error is signalled and renaming is not done.

M-x view-buffer is similar to M-x view-file (see Misc File Ops), but it examines an already existing Emacs buffer. View mode provides convenient commands for scrolling through the buffer but not for changing it. When you exit View mode, the resulting value of point remains in effect.

To copy text from one buffer to another, use the commands M-x append-to-buffer and M-x insert-buffer. See Accumulating Text.