From: Richard M. Stallman Date: Mon, 26 Nov 2001 10:09:56 +0000 (+0000) Subject: (save-selected-window): No error if saved window is dead. X-Git-Tag: ttn-vms-21-2-B4~18149 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=f9fa0e8aea7c36701594732269ea294fd22a6a26;p=emacs.git (save-selected-window): No error if saved window is dead. --- 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.