to the selected one. The return value is @code{nil} if @var{window} is
a live window or its children form a vertical combination. In the
example above @code{(window-left-child W4)} is @code{W6} while
-@code{(window-top-child W3)} is @code{nil}.
+@code{(window-left-child W3)} is @code{nil}.
@end defun
@defun window-child window
buffer; it defaults to the current buffer.
If a window displaying @var{buffer-or-name} is dedicated
-(@pxref{Dedicated Windows}) has never displayed any other buffers and
+(@pxref{Dedicated Windows}), has never displayed any other buffers and
is not the only window on its frame, that window is deleted. If that
-window is the only window on its frame and there are other frames on
-the frame's terminal, that frame is deleted too; otherwise, some other
-buffer is displayed in that window, as explained above. A user can
-prevent the deletion of windows and/or frames by customizing the
-option @code{window-auto-delete}.
+window is the only window on its frame and there are other frames on the
+frame's terminal, that frame is deleted too; otherwise, the buffer
+provided by the function @code{switch-to-prev-buffer} (@pxref{Window
+History}) is displayed instead.
@end deffn
+
@node Switching Buffers
@section Switching to a Buffer in a Window
@cindex switching to a buffer
list (@pxref{The Buffer List}). However, this is not done if the
optional argument @var{norecord} is non-@code{nil}.
-If this function is unable to display in the seleted window---usually
-because the selected window is a minibuffer window or is strongly
-dedicated to its buffer (@pxref{Dedicated Windows})---then it normally
-tries to display in some other window, in the manner of
-@code{pop-to-buffer} (see below). However, if the optional argument
-@var{force-same-window} is non-@code{nil}, it signals an error
+If this function is unable to display the buffer in the selected
+window---usually because the selected window is a minibuffer window or
+is strongly dedicated to its buffer (@pxref{Dedicated Windows})---then
+it normally tries to display the buffer in some other window, in the
+manner of @code{pop-to-buffer} (see below). However, if the optional
+argument @var{force-same-window} is non-@code{nil}, it signals an error
instead.
@end deffn
@defun display-buffer-use-some-window buffer alist
This function tries to display @var{buffer} by choosing an existing
-buffer and displaying the buffer in that window. It can fail if all
+window and displaying the buffer in that window. It can fail if all
windows are dedicated to another buffer (@pxref{Dedicated Windows}).
@end defun
resort, it will try to display @var{buffer-or-name} on a separate frame.
In that case, the value of @code{pop-up-frames} is disregarded.
+
@node Window History
@section Window History
@cindex window history
- Each window remembers the buffers it has displayed earlier and the
-order in which these buffers have been removed from it. This history
-is used, for example, by @code{replace-buffer-in-windows}
-(@pxref{Buffers and Windows}). This list is set automatically
-maintained by Emacs, but you can use the following functions to
-explicitly inspect or alter it:
+Each window remembers the buffers it has displayed earlier and the order
+in which these buffers have been removed from it. This history is used,
+for example, by @code{replace-buffer-in-windows} (@pxref{Buffers and
+Windows}). This list is automatically maintained by Emacs, but you can
+use the following functions to explicitly inspect or alter it:
@defun window-prev-buffers &optional window
This function returns a list specifying the previous contents of
that buffer was last shown.
The list is ordered so that earlier elements correspond to more
-recently-shown buffers, and the first element corresponds to the
+recently-shown buffers, and the first element usually corresponds to the
buffer most recently removed from the window.
@end defun
@defun window-next-buffers &optional window
This function returns the list of buffers recently re-shown in
-@var{window} via @code{switch-to-prev-buffer}. @var{window} should be
-a live window or @code{nil} (meaning the selected window).
+@var{window} via @code{switch-to-prev-buffer}. The @var{window}
+argument must denote a live window or @code{nil} (meaning the selected
+window).
@end defun
@defun set-window-next-buffers window next-buffers
If repeated invocations of this command have already shown all buffers
previously shown in @var{window}, further invocations will show buffers
-from the global buffer list starting with the buffer returned by
-@code{last-buffer} (@pxref{The Buffer List}).
+from the buffer list of the frame @var{window} appears on (@pxref{The
+Buffer List}).
@end deffn
@deffn Command switch-to-next-buffer &optional window
@var{window}. The argument @var{window} must be a live window and
defaults to the selected one.
-If there is no recent invocation of a @code{switch-to-prev-buffer}
-that can be undone, this function tries to show the first buffer from
-the global buffer list as returned by @code{other-buffer} (@pxref{The
-Buffer List}).
+If there is no recent invocation of a @code{switch-to-prev-buffer} that
+can be undone, this function tries to show a buffer from the buffer list
+of the frame @var{window} appears on (@pxref{The Buffer List}).
@end deffn
+
@node Dedicated Windows
@section Dedicated Windows
@cindex dedicated window