Go to the first, previous, next, last section, table of contents.


Destroying Buffers

Since all Lisp objects have indefinite extent (i.e. they live until there are no references to them) a buffer will be automatically destroyed when all references to it disappear.

Alternatively one of the following functions can be used to explicitly kill a buffer; the buffer object will still exist but all data associated with it (including the text it contains) will be released.

Command: kill-buffer buffer
Removes the buffer buffer (a buffer or the name of a buffer) from all windows (any windows displaying buffer will be changed to display the previous buffer they showed) and destroys the buffer.

The hook kill-buffer-hook is evaluated before the buffer is killed with buffer as its argument.

If the buffer contains unsaved modifications the user will be asked if they really want to lose them before the buffer is killed (if the answer is yes).

When called interactively a buffer will be prompted for.

Hook: kill-buffer-hook
Hook called by kill-buffer before it does anything. If a function in the hook doesn't want the buffer deleted it should signal some sort of error.

Function: destroy-buffer buffer
This function may be used to remove all data stored in the buffer object manually. Also, any marks in this buffer are made non-resident.

After applying this function to a buffer the buffer will contain one empty line.

Use this function wisely, there are no safety measures taken to ensure valuable data is not lost.


Go to the first, previous, next, last section, table of contents.