changeset 41541:9736d12fa64c

(save-selected-window): No error if saved window is dead.
author Richard M. Stallman <rms@gnu.org>
date Mon, 26 Nov 2001 10:09:56 +0000
parents cbb3e2c07f7a
children f30168d4d5e6
files lisp/window.el
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/window.el	Mon Nov 26 10:04:00 2001 +0000
+++ b/lisp/window.el	Mon Nov 26 10:09:56 2001 +0000
@@ -127,11 +127,14 @@
   (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.