Next: , Previous: , Up: Top   [Contents][Index]


15 Using Multiple Buffers

Text you are editing in Emacs resides in an object called a buffer. Each time you visit a file, Emacs creates a buffer to hold the file’s text. Each time you invoke Dired, Emacs creates a buffer 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, it appears in a buffer called ‘*Help*’.

At any time, one and only one buffer is selected. It is also called the current buffer. Saying a command operates on “the buffer” really means that the command operates on the selected buffer, as most commands do.

When Emacs creates multiple windows, each window has a chosen buffer which is displayed there, but at any time only one of the windows is selected and its chosen buffer is the selected buffer. Each window’s mode line displays the name of the buffer the window is displaying (see Windows).

Each buffer has a name which can be of any length but is case-sensitive. You can select a buffer using its name. Most buffers are created when you visit files; their names are derived from the files’ names. You can also create an empty buffer with any name you want. A newly started Emacs has a buffer named ‘*scratch*’ which you can use for evaluating Lisp expressions in Emacs.

Each buffer records what file it is visiting, whether it is modified, and what major mode and minor modes are in effect in it (see 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 Locals.


Next: , Previous: , Up: Top   [Contents][Index]