diff options
author | Richard M. Stallman <rms@gnu.org> | 2002-12-23 17:57:12 +0000 |
---|---|---|
committer | Richard M. Stallman <rms@gnu.org> | 2002-12-23 17:57:12 +0000 |
commit | 991ce473781bbd487165287265524df80811900f (patch) | |
tree | 36b8eefc88362098fe4d1abf54caba343463c8ad /lisp/window.el | |
parent | 7c3da01bf2920b59afbb682b26acdee42e280cf5 (diff) | |
download | emacs-991ce473781bbd487165287265524df80811900f.tar.gz |
(save-selected-window): Save and restore selected windows of all frames.
Diffstat (limited to 'lisp/window.el')
-rw-r--r-- | lisp/window.el | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/lisp/window.el b/lisp/window.el index 98d5f9963f1..bacd9161ea5 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -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))))) |