[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
24. Using Multiple Buffers
The text you are editing in Emacs resides in an object called a buffer. Each time you visit a file, a buffer is created to hold the file's text. Each time you invoke Dired, a buffer is created to hold the directory listing. If you send a message with C-x m, a buffer named ‘*mail*’ is used to hold the text of the message. When you ask for a command's documentation, that appears in a buffer called ‘*Help*’.
At any time, one and only one buffer is current. It is also called the selected buffer. Often we say that a command operates on “the buffer” as if there were only one; but really this means that the command operates on the current buffer (most commands do).
When Emacs has multiple windows, each window has its own chosen buffer and displays it; at any time, only one of the windows is selected, and its chosen buffer is the current buffer. Each window's mode line normally displays the name of the window's chosen buffer (see section Multiple Windows).
Each buffer has a name, which can be of any length, and you can select any buffer by giving its name. Most buffers are made by visiting files, and their names are derived from the files' names. But you can also create an empty buffer with any name you want. A newly started Emacs has a buffer named ‘*scratch*’ which can be used for evaluating Lisp expressions in Emacs. The distinction between upper and lower case matters in buffer names.
Each buffer records individually what file it is visiting, whether it is modified, and what major mode and minor modes are in effect in it (see section Major Modes). Any Emacs variable can be made local to a particular buffer, meaning its value in that buffer can be different from the value in other buffers. See section Local Variables.
A buffer's size cannot be larger than some maximum, which is defined by the largest buffer position representable by the Emacs integer data type. This is because Emacs tracks buffer positions using that data type. For 32-bit machines, the largest buffer size is 256 megabytes.
24.1 Creating and Selecting Buffers | Creating a new buffer or reselecting an old one. | |
24.2 Listing Existing Buffers | Getting a list of buffers that exist. | |
24.3 Miscellaneous Buffer Operations | Renaming; changing read-onlyness; copying text. | |
24.4 Killing Buffers | Killing buffers you no longer need. | |
24.5 Operating on Several Buffers | How to go through the list of all buffers and operate variously on several of them. | |
24.6 Indirect Buffers | An indirect buffer shares the text of another buffer. | |
24.7 Convenience Features and Customization of Buffer Handling | Convenience and customization features for buffer handling. |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |