[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

27.11 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 among files. The base buffer may not itself be an indirect buffer.

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. This includes the text properties as well as the characters themselves.

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 and overlays (though inserting or deleting text in either buffer relocates the markers and overlays for both), different major modes, and different buffer-local variables.

An indirect buffer cannot visit a file, but its base buffer can. If you try to save the indirect buffer, that actually saves the base buffer.

Killing an indirect buffer has no effect on its base buffer. Killing the base buffer effectively kills the indirect buffer in that it cannot ever again be the current buffer.

Command: make-indirect-buffer base-buffer name
This creates an indirect buffer named name whose base buffer is base-buffer. The argument base-buffer may be a buffer or a string. If base-buffer is an indirect buffer, its base buffer is used as the base for the new buffer.

Function: buffer-base-buffer buffer
This function returns the base buffer of buffer. If buffer is not indirect, the value is nil. Otherwise, the value is another buffer, which is never an indirect buffer.



This document was generated on May 2, 2002 using texi2html