Next: The Text in a Buffer, Up: Buffers and Textual Representation [Contents][Index]
A buffer is logically just a Lisp object that holds some text. In this, it is like a string, but a buffer is optimized for frequent insertion and deletion, while a string is not. Furthermore:
current_buffer
. Buffer operations operate
on this buffer by default. When you are typing text into a buffer, the
buffer you are typing into is always current_buffer
. Switching
to a different window changes the current buffer. Note that Lisp code
can temporarily change the current buffer using set-buffer
(often
enclosed in a save-excursion
so that the former current buffer
gets restored when the code is finished). However, calling
set-buffer
will NOT cause a permanent change in the current
buffer. The reason for this is that the top-level event loop sets
current_buffer
to the buffer of the selected window, each time
it finishes executing a user command.
Make sure you understand the distinction between current buffer and buffer of the selected window, and the distinction between point of the current buffer and window-point of the selected window. (This latter distinction is explained in detail in the section on windows.)
Next: The Text in a Buffer, Up: Buffers and Textual Representation [Contents][Index]