select-window
select-window is a built-in function in `C source code
'.
(select-window WINDOW &optional NORECORD)
Select WINDOW which must be a live window.
Also make WINDOW's frame the selected frame and WINDOW that frame's
selected window. In addition, make WINDOW's buffer current and set its
buffer's value of `point' to the value of WINDOW's `window-point'.
Return WINDOW.
Optional second arg NORECORD non-nil means do not put this buffer at the
front of the buffer list and do not make this window the most recently
selected one.
Run `buffer-list-update-hook' unless NORECORD is non-nil. Note that
applications and internal routines often select a window temporarily for
various purposes; mostly, to simplify coding. As a rule, such
selections should be not recorded and therefore will not pollute
`buffer-list-update-hook'. Selections that "really count" are those
causing a visible change in the next redisplay of WINDOW's frame and
should be always recorded. So if you think of running a function each
time a window gets selected put it on `buffer-list-update-hook'.
Also note that the main editor command loop sets the current buffer to
the buffer of the selected window before each command.