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: List Buffers, Up: Buffers


24.3 Miscellaneous Buffer Operations

C-x C-q
Toggle read-only status of buffer (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 (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 the buffer read-only if its value is non-nil. If you have files under version control, you may find it convenient to bind C-x C-q to vc-toggle-read-only instead. Then, typing C-x C-q not only changes the read-only flag, but it also checks the file in or out. See 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. (With some of these features, such as M-x compile, M-x grep an M-x info, you need to switch to some other buffer before using the command, in order for it to make a different buffer.)

M-x view-buffer is much like M-x view-file (see Misc File Ops) 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 with q, that switches back to the buffer (and the position) which was previously displayed in the window. Alternatively, if you exit View mode with e, the buffer and the value of point that resulted from your perusal remain 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 Accumulating Text.


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