diff options
| author | Richard M. Stallman | 2001-11-26 10:09:56 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2001-11-26 10:09:56 +0000 |
| commit | f9fa0e8aea7c36701594732269ea294fd22a6a26 (patch) | |
| tree | d3781276e93c2ec78de31e8a639f8df97ac45536 | |
| parent | 240cbfca032e4ecfb0b95b68424319b89215d27e (diff) | |
| download | emacs-f9fa0e8aea7c36701594732269ea294fd22a6a26.tar.gz emacs-f9fa0e8aea7c36701594732269ea294fd22a6a26.zip | |
(save-selected-window): No error if saved window is dead.
| -rw-r--r-- | lisp/window.el | 7 |
1 files 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." | |||
| 127 | (eq window (active-minibuffer-window))) | 127 | (eq window (active-minibuffer-window))) |
| 128 | 128 | ||
| 129 | (defmacro save-selected-window (&rest body) | 129 | (defmacro save-selected-window (&rest body) |
| 130 | "Execute BODY, then select the window that was selected before BODY." | 130 | "Execute BODY, then select the window that was selected before BODY. |
| 131 | However, if that window has become dead, don't get an error, | ||
| 132 | just refrain from switching to it." | ||
| 131 | `(let ((save-selected-window-window (selected-window))) | 133 | `(let ((save-selected-window-window (selected-window))) |
| 132 | (unwind-protect | 134 | (unwind-protect |
| 133 | (progn ,@body) | 135 | (progn ,@body) |
| 134 | (select-window save-selected-window-window)))) | 136 | (if (window-live-p save-selected-window-window) |
| 137 | (select-window save-selected-window-window))))) | ||
| 135 | 138 | ||
| 136 | (defun count-windows (&optional minibuf) | 139 | (defun count-windows (&optional minibuf) |
| 137 | "Return the number of visible windows. | 140 | "Return the number of visible windows. |