with-current-buffer-window

with-current-buffer-window is a Lisp macro in `window.el'.

(with-current-buffer-window BUFFER-OR-NAME ACTION QUIT-FUNCTION &rest BODY)

Evaluate BODY with a buffer BUFFER-OR-NAME current and show that buffer.
This construct is like `with-temp-buffer-window' but unlike that
makes the buffer specified by BUFFER-OR-NAME current for running
BODY.