# HG changeset patch # User Richard M. Stallman # Date 1006769396 0 # Node ID 9736d12fa64c04839b18c7f4d7136c2cb74ad595 # Parent cbb3e2c07f7aa3c18bbd38022871551df9438ac0 (save-selected-window): No error if saved window is dead. diff -r cbb3e2c07f7a -r 9736d12fa64c lisp/window.el --- 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.