Function: next-window

next-window is a function defined in window.c.

Signature

(next-window &optional WINDOW MINIBUF ALL-FRAMES)

Documentation

Return live window after WINDOW in the cyclic ordering of windows.

WINDOW must be a live window and defaults to the selected one. The optional arguments MINIBUF and ALL-FRAMES specify the set of windows to consider.

MINIBUF nil or omitted means consider the minibuffer window only if the minibuffer is active. MINIBUF t means consider the minibuffer window even if the minibuffer is not active. Any other value means do not consider the minibuffer window even if the minibuffer is active.

ALL-FRAMES nil or omitted means consider all windows on WINDOW's frame, plus the minibuffer window if specified by the MINIBUF argument. If the minibuffer counts, consider all windows on all frames that share that minibuffer too. The following non-nil values of ALL-FRAMES have special meanings:

- t means consider all windows on all existing frames.

- visible means consider all windows on all visible frames.

- 0 (the number zero) means consider all windows on all visible and
  iconified frames.

- A frame means consider all windows on that frame only.

Anything else means consider all windows on WINDOW's frame and no others.

If you use consistent values for MINIBUF and ALL-FRAMES, you can use next-window to iterate through the entire cycle of acceptable windows, eventually ending up back at the window you started with. previous-window traverses the same cycle, in the reverse order.

View in manual

Probably introduced at or before Emacs version 18.

Source Code

// Defined in /usr/src/emacs/src/window.c
{
  return next_window (window, minibuf, all_frames, true);
}