Function: tab-bar-select-restore-windows
tab-bar-select-restore-windows is a byte-compiled function defined in
tab-bar.el.gz.
Signature
(tab-bar-select-restore-windows FRAME WINDOWS TYPE)
Documentation
Display a placeholder buffer in the window whose buffer was killed.
There is a button in the window which you can press to restore the killed buffer, if that buffer was visiting a file.
Probably introduced at or before Emacs version 30.1.
Source Code
;; Defined in /usr/src/emacs/lisp/tab-bar.el.gz
(defun tab-bar-select-restore-windows (_frame windows _type)
"Display a placeholder buffer in the window whose buffer was killed.
There is a button in the window which you can press to restore the
killed buffer, if that buffer was visiting a file."
(dolist (quad windows)
(when (window-live-p (nth 0 quad))
(let* ((window (nth 0 quad))
(old-buffer (nth 1 quad))
(file (when (bufferp old-buffer)
(buffer-file-name old-buffer)))
(name (or file
(and (bufferp old-buffer)
(buffer-last-name old-buffer))
old-buffer))
(new-buffer (generate-new-buffer
(format " *Old buffer %s*" name))))
(with-current-buffer new-buffer
(insert (format-message "This window displayed the %s `%s'.\n"
(if file "file" "buffer")
name))
(when file
(insert-button
"[Restore]" 'action
(lambda (_button)
(set-window-buffer window (find-file-noselect file))
(set-window-start window (nth 2 quad) t)
(set-window-point window (nth 3 quad))))
(insert "\n"))
(goto-char (point-min))
(special-mode)
(set-window-buffer window new-buffer))))))