Mercurial > emacs
changeset 48941:7262fd90146a
(save-selected-window): Save and restore selected windows of all frames.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Mon, 23 Dec 2002 17:57:12 +0000 |
parents | 78987e4bee15 |
children | 86ecd875b9c5 |
files | lisp/window.el |
diffstat | 1 files changed, 12 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/window.el Mon Dec 23 17:54:31 2002 +0000 +++ b/lisp/window.el Mon Dec 23 17:57:12 2002 +0000 @@ -31,11 +31,20 @@ (defmacro save-selected-window (&rest 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))) +Also restore the selected window of each frame as it was at the start +of this construct. +However, if a window has become dead, don't get an error, +just refrain from reselecting it." + `(let ((save-selected-window-window (selected-window)) + (save-selected-window-alist + (mapcar (lambda (frame) (list frame (frame-selected-window frame))) + (frame-list)))) (unwind-protect (progn ,@body) + (dolist (elt save-selected-window-alist) + (and (frame-live-p (car elt)) + (window-live-p (cadr elt)) + (set-frame-selected-window (car elt) (cadr elt)))) (if (window-live-p save-selected-window-window) (select-window save-selected-window-window)))))