The current buffer is the buffer being displayed in the current window (see section Windows), all functions which take an optional buffer argument will operate on the current buffer if this argument is undefined. Similarly if a window argument to a function is left undefined the current window will be used.
(current-buffer)
=> #<buffer programmer.texi>
The set-current-buffer function sets the current buffer of a window.
If, when the window is next redisplayed (i.e. after each command), the
current buffer is different to what it was at the last redisplay the new
buffer will be displayed in the window.
Usually a window's current buffer will be the buffer which is at the head
of the window's buffer-list. The function goto-buffer can
be used to set both of these at once.
buffer-list.
If buffer is a string and no buffer exists of that name a new one is created.
Often you will want to temporarily switch to a different current buffer,
that is what the with-buffer special form is for.
If the implicit progn evaluating forms is exited abnormally the old value of the current buffer will still be reinstated.
If the window is redisplayed while the forms are being evaluated (i.e. in a recursive edit) the new buffer will be drawn into the window.
(with-buffer new-buffer ;Enter a recursive edit in
(recursive-edit)) ; the buffer new-buffer.
Go to the first, previous, next, last section, table of contents.