Next: , Previous: , Up: Current Buffer   [Index]


7.4.3.2 set-buffer

Function: set-buffer buffer-or-name

Make buffer BUFFER-OR-NAME current for editing operations.

BUFFER-OR-NAME

may be a buffer or the name of an existing buffer.

When an editing command returns to the editor command loop, Emacs automatically calls set-buffer on the buffer shown in the selected window. you should not use set-buffer to switch visibly to a different buffer; for that, use the functions described in Switching Buffers. However, when writing a Lisp function, do not rely on this behavior of the command loop to restore the current buffer after an operation.

To operate temporarily on another buffer, put the set-buffer within a save-current-buffer form.