This section describes low-level functions for examining and setting the contents of windows. See Switching to a Buffer in a Window, for higher-level functions for displaying a specific buffer in a window.
This function returns the buffer that window is displaying. If
window is omitted or nil
it defaults to the selected
window. If window is an internal window, this function returns
nil
.
This function makes window display buffer-or-name.
window should be a live window; if nil
, it defaults to
the selected window. buffer-or-name should be a buffer, or the
name of an existing buffer. This function does not change which
window is selected, nor does it directly change which buffer is
current (see The Current Buffer). Its return value is nil
.
If window is strongly dedicated to a buffer and buffer-or-name does not specify that buffer, this function signals an error. See Dedicated Windows.
By default, this function resets window’s position, display
margins, fringe widths, and scroll bar settings, based on the local
variables in the specified buffer. However, if the optional argument
keep-margins is non-nil
, it leaves window’s display
margins, fringes and scroll bar settings alone.
When writing an application, you should normally use
display-buffer
(see Choosing a Window for Displaying a Buffer) or the higher-level
functions described in Switching to a Buffer in a Window, instead of calling
set-window-buffer
directly.
This runs window-scroll-functions
, followed by
window-configuration-change-hook
. See Hooks for Window Scrolling and Changes.
This buffer-local variable records the number of times a buffer has been
displayed in a window. It is incremented each time
set-window-buffer
is called for the buffer.
This buffer-local variable records the time at which a buffer was last
displayed in a window. The value is nil
if the buffer has
never been displayed. It is updated each time
set-window-buffer
is called for the buffer, with the value
returned by current-time
(see Time of Day).
This function returns the first window displaying buffer-or-name
in the cyclic ordering of windows, starting from the selected window
(see Cyclic Ordering of Windows). If no such window exists, the
return value is nil
.
buffer-or-name should be a buffer or the name of a buffer; if
omitted or nil
, it defaults to the current buffer. The
optional argument all-frames specifies which windows to
consider:
t
means consider windows on all existing frames.
visible
means consider windows on all visible frames.
Note that these meanings differ slightly from those of the
all-frames argument to next-window
(see Cyclic Ordering of Windows). This function may be changed in a future version of Emacs
to eliminate this discrepancy.
This function returns a list of all windows currently displaying
buffer-or-name. buffer-or-name should be a buffer or the
name of an existing buffer. If omitted or nil
, it defaults to
the current buffer. If the currently selected window displays
buffer-or-name, it will be the first in the list returned by
this function.
The arguments minibuf and all-frames have the same
meanings as in the function next-window
(see Cyclic Ordering of Windows). Note that the all-frames argument does not
behave exactly like in get-buffer-window
.
This command replaces buffer-or-name with some other buffer, in
all windows displaying it. buffer-or-name should be a buffer, or
the name of an existing buffer; if omitted or nil
, it defaults to
the current buffer.
The replacement buffer in each window is chosen via
switch-to-prev-buffer
(see Window History). With the
exception of side windows (see Side Windows), any dedicated window
displaying buffer-or-name is deleted if possible (see Dedicated Windows). If such a window is the only window on its frame and there
are other frames on the same terminal, the frame is deleted as well.
If the dedicated window is the only window on the only frame on its
terminal, the buffer is replaced anyway.