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


24.6 Indirect Buffers

An indirect buffer shares the text of some other buffer, which is called the base buffer of the indirect buffer. In some ways it is the analogue, for buffers, of a symbolic link between files.

M-x make-indirect-buffer <RET> base-buffer <RET> indirect-name <RET>
Create an indirect buffer named indirect-name whose base buffer is base-buffer.
M-x clone-indirect-buffer <RET>
Create an indirect buffer that is a twin copy of the current buffer.
C-x 4 c
Create an indirect buffer that is a twin copy of the current buffer, and select it in another window (clone-indirect-buffer-other-window).

The text of the indirect buffer is always identical to the text of its base buffer; changes made by editing either one are visible immediately in the other. But in all other respects, the indirect buffer and its base buffer are completely separate. They have different names, different values of point, different narrowing, different markers, different major modes, and different local variables.

An indirect buffer cannot visit a file, but its base buffer can. If you try to save the indirect buffer, that actually works by saving the base buffer. Killing the base buffer effectively kills the indirect buffer, but killing an indirect buffer has no effect on its base buffer.

One way to use indirect buffers is to display multiple views of an outline. See Outline Views.

A quick and handy way to make an indirect buffer is with the command M-x clone-indirect-buffer. It creates and selects an indirect buffer whose base buffer is the current buffer. With a numeric argument, it prompts for the name of the indirect buffer; otherwise it uses the name of the current buffer, with a ‘<n>’ suffix added. C-x 4 c (clone-indirect-buffer-other-window) works like M-x clone-indirect-buffer, but it selects the new buffer in another window.

The more general way to make an indirect buffer is with the command M-x make-indirect-buffer. It creates an indirect buffer from buffer base-buffer, under the name indirect-name. It prompts for both base-buffer and indirect-name using the minibuffer.


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