Toggle read-only status of buffer (
Change the name of the current buffer.
Rename the current buffer by adding ‘<number>’ to the end.
Scroll through buffer buffer. See View Mode.
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. See Mode Line. 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.
The command C-x C-q (
read-only-mode) 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 the buffer read-only if its value is
nil. If you change the option
view-read-only to a
nil value, making the buffer read-only with C-x C-q
also enables View mode in the buffer (see View Mode).
M-x rename-buffer changes the name of the current buffer. You 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. (With some of these features, such as M-x compile, M-x grep, you need to switch to some other buffer before using the command again, otherwise it will reuse the current buffer despite the name change.)
The commands M-x append-to-buffer and M-x insert-buffer can also be used to copy text from one buffer to another. See Accumulating Text.