Selecting Windows
=================
When a window is selected, the buffer in the window becomes the
current buffer, and the cursor will appear in it.
- Function: selected-window
This function returns the selected window. This is the window in
which the cursor appears and to which many commands apply.
- Function: select-window window
This function makes WINDOW the selected window. The cursor then
appears in WINDOW (on redisplay). The buffer being displayed in
WINDOW is immediately designated the current buffer.
The return value is WINDOW.
(setq w (next-window))
(select-window w)
=> #<window 65 on windows.texi>
- Macro: save-selected-window forms...
This macro records the selected window, executes FORMS in
sequence, then restores the earlier selected window.
This macro does not save or restore anything about the sizes,
arrangement or contents of windows; therefore, if the FORMS change
them, the change persists.
Each frame, at any time, has a window selected within the frame.
This macro saves only _the_ selected window; it does not save
anything about other frames. If the FORMS select some other frame
and alter the window selected within it, the change persists.
The following functions choose one of the windows on the screen,
offering various criteria for the choice.
- Function: get-lru-window &optional frame
This function returns the window least recently "used" (that is,
selected). The selected window is always the most recently used
window.
The selected window can be the least recently used window if it is
the only window. A newly created window becomes the least
recently used window until it is selected. A minibuffer window is
never a candidate.
The argument FRAME controls which windows are considered.
* If it is `nil', consider windows on the selected frame.
* If it is `t', consider windows on all frames.
* If it is `visible', consider windows on all visible frames.
* If it is 0, consider windows on all visible or iconified
frames.
* If it is a frame, consider windows on that frame.
- Function: get-largest-window &optional frame
This function returns the window with the largest area (height
times width). If there are no side-by-side windows, then this is
the window with the most lines. A minibuffer window is never a
candidate.
If there are two windows of the same size, then the function
returns the window that is first in the cyclic ordering of windows
(see following section), starting from the selected window.
The argument FRAME controls which set of windows to consider. See
`get-lru-window', above.
- Function: get-window-with-predicate predicate &optional minibuf
all-frames default
This function returns a window satisfying PREDICATE. It cycles
through all visible windows using `walk-windows' (Note:Cyclic
Window Ordering), calling PREDICATE on each one one of them with
that window as its argument. The function returns the first
window for which PREDICATE returns a non-`nil' value; if that
never happens, it returns DEFAULT.
The optional arguments MINIBUF and ALL-FRAMES specify the set of
windows to include in the scan. See the description of
`next-window' in Note:Cyclic Window Ordering, for details.