]> git.eshelyaron.com Git - emacs.git/commitdiff
(save-selected-window): No error if saved window is dead.
authorRichard M. Stallman <rms@gnu.org>
Mon, 26 Nov 2001 10:09:56 +0000 (10:09 +0000)
committerRichard M. Stallman <rms@gnu.org>
Mon, 26 Nov 2001 10:09:56 +0000 (10:09 +0000)
lisp/window.el

index 4d97117a4eb19a2b91896fb631fb5149849cfb6b..532a1cc0009026938fb4b6a4be6f04237a47f240 100644 (file)
@@ -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)))))
 \f
 (defun count-windows (&optional minibuf)
    "Return the number of visible windows.