Next: Indirect Buffers, Previous: The Buffer List, Up: Buffers [Index]
There are two primitives for creating buffers, plus several others:
get-buffer-create
creates a buffer if it finds no existing buffer with the specified name;
generate-new-buffer
always creates a new buffer and gives it a unique name.
with-output-to-temp-buffer
create-file-buffer
Killing a buffer makes its name unknown to Emacs and makes the memory space it occupied available for other use. The ‘buffer-name’ of a buffer is ‘nil’ if, and only if, the buffer is killed. If you kill a buffer that is current or displayed in a window, Emacs automatically selects or displays some other buffer instead. Killing a buffer can change the current buffer. If you kill a buffer that is the base buffer of one or more indirect buffers, the indirect buffers are automatically killed as well.
A buffer that has not been killed is called a live buffer. To test whether a
buffer is live or killed, use the function buffer-live-p
(see below).