save-window-excursion
save-window-excursion is a Lisp macro in `subr.el
'.
(save-window-excursion &rest BODY)
Execute BODY, then restore previous window configuration.
This macro saves the window configuration on the selected frame,
executes BODY, then calls `set-window-configuration' to restore
the saved window configuration. The return value is the last
form in BODY. The window configuration is also restored if BODY
exits nonlocally.
BEWARE: Most uses of this macro introduce bugs.
E.g. it should not be used to try and prevent some code from opening
a new window, since that window may sometimes appear in another frame,
in which case `save-window-excursion' cannot help.