From f9fa0e8aea7c36701594732269ea294fd22a6a26 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Mon, 26 Nov 2001 10:09:56 +0000 Subject: [PATCH] (save-selected-window): No error if saved window is dead. --- lisp/window.el | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lisp/window.el b/lisp/window.el index 4d97117a4eb..532a1cc0009 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -127,11 +127,14 @@ Anything else means restrict to the selected frame." (eq window (active-minibuffer-window))) (defmacro save-selected-window (&rest body) - "Execute BODY, then select the window that was selected before BODY." + "Execute BODY, then select the window that was selected before BODY. +However, if that window has become dead, don't get an error, +just refrain from switching to it." `(let ((save-selected-window-window (selected-window))) (unwind-protect (progn ,@body) - (select-window save-selected-window-window)))) + (if (window-live-p save-selected-window-window) + (select-window save-selected-window-window))))) (defun count-windows (&optional minibuf) "Return the number of visible windows. -- 2.39.5