Function: window-old-buffer
window-old-buffer is a function defined in window.c.
Signature
(window-old-buffer &optional WINDOW)
Documentation
Return the old buffer displayed by WINDOW.
WINDOW can be any window and defaults to the selected one.
The return value is the buffer shown in WINDOW at the last time window change functions were run or WINDOW is a former live window that was deleted. It is nil if WINDOW was created after that. It is t if WINDOW has been restored from a window configuration after that. It is always nil if WINDOW is an internal window.
Probably introduced at or before Emacs version 27.1.
Source Code
// Defined in /usr/src/emacs/src/window.c
{
struct window *w = decode_any_window (window);
return (NILP (w->old_buffer)
/* A new window. */
? Qnil
: (w->change_stamp != WINDOW_XFRAME (w)->change_stamp)
/* A window restored from a configuration. */
? Qt
/* A window that was live the last time seen by window change
functions or was deleted. */
: w->old_buffer);
}