Variable: window-restore-killed-buffer-windows

window-restore-killed-buffer-windows is a variable defined in window.c.

Value

nil

Documentation

Control restoring windows whose buffer was killed.

This variable specifies how the functions set-window-configuration and window-state-put shall handle a window whose buffer has been killed since the corresponding configuration or state was recorded. Any such window may be live -- in which case it shows some other buffer -- or dead at the time one of these functions is called.

By default, set-window-configuration leaves the window alone if it is live, while window-state-put deletes it. The following values can be used to override the default behavior for dead windows in the case of set-window-configuration and for dead and live windows in the case of window-state-put.

 - t means to restore the window and show some other buffer in it.

 - delete means to try to delete the window.

 - dedicated means to try to delete the window if and only if it is
   dedicated to its buffer.

 - nil, the default, which means that set-window-configuration will
   try to delete the window if and only if it is dedicated to its
   buffer while window-state-put will unconditionally try to delete
   it.

 - a function means to restore the window and show some other buffer in
   it, like if the value were t, but also to add an entry for that
   window to a list that will be later passed as argument to that
   function.

If a window cannot be deleted (typically, because it is the last window on its frame), show another buffer in it.

If the value is a function, it should take three arguments. The first argument specifies the frame whose windows have been restored. The third argument is the symbol configuration if the windows are restored by set-window-configuration and the symbol state if the windows are restored by window-state-put.

The second argument specifies a list of entries for all windows whose previous buffers have been found dead at the time set-window-configuration or window-state-put tried to restore them
(minibuffer windows are excluded). This means that the function
specified by this variable may also delete windows which were found to be alive by set-window-configuration.

Each entry is a list of six values: the window whose buffer was found dead, the dead buffer or its name, the positions of window-start and window-point of the buffer in that window, the dedicated state of the window as reported by window-dedicated-p, and a boolean -- t if the window was live when set-window-configuration tried to restore it, and nil otherwise.

View in manual

Probably introduced at or before Emacs version 30.1.

Source Code

// Defined in /usr/src/emacs/src/window.c
  DEFVAR_LISP ("window-restore-killed-buffer-windows",
	       window_restore_killed_buffer_windows,
	       doc: /* Control restoring windows whose buffer was killed.
This variable specifies how the functions `set-window-configuration' and
`window-state-put' shall handle a window whose buffer has been killed
since the corresponding configuration or state was recorded.  Any such
window may be live -- in which case it shows some other buffer -- or
dead at the time one of these functions is called.

By default, `set-window-configuration' leaves the window alone if it is
live, while `window-state-put' deletes it.  The following values can be
used to override the default behavior for dead windows in the case of
`set-window-configuration' and for dead and live windows in the case of
`window-state-put'.

 - t means to restore the window and show some other buffer in it.

 - `delete' means to try to delete the window.

 - `dedicated' means to try to delete the window if and only if it is
   dedicated to its buffer.

 - nil, the default, which means that `set-window-configuration' will
   try to delete the window if and only if it is dedicated to its
   buffer while `window-state-put' will unconditionally try to delete
   it.

 - a function means to restore the window and show some other buffer in
   it, like if the value were t, but also to add an entry for that
   window to a list that will be later passed as argument to that
   function.

If a window cannot be deleted (typically, because it is the last window
on its frame), show another buffer in it.

If the value is a function, it should take three arguments.  The first
argument specifies the frame whose windows have been restored.  The
third argument is the symbol `configuration' if the windows are
restored by `set-window-configuration' and the symbol `state' if the
windows are restored by `window-state-put'.

The second argument specifies a list of entries for all windows whose
previous buffers have been found dead at the time
`set-window-configuration' or `window-state-put' tried to restore them
(minibuffer windows are excluded).  This means that the function
specified by this variable may also delete windows which were found to
be alive by `set-window-configuration'.

Each entry is a list of six values: the window whose buffer was found
dead, the dead buffer or its name, the positions of window-start and
window-point of the buffer in that window, the dedicated state of the
window as reported by `window-dedicated-p', and a boolean -- t if the
window was live when `set-window-configuration' tried to restore it,
and nil otherwise.  */);