]> git.eshelyaron.com Git - emacs.git/commitdiff
(save-selected-window): New macro.
authorKarl Heuer <kwzh@gnu.org>
Sun, 11 Jun 1995 19:27:57 +0000 (19:27 +0000)
committerKarl Heuer <kwzh@gnu.org>
Sun, 11 Jun 1995 19:27:57 +0000 (19:27 +0000)
lisp/window.el

index 899bbb0bdcc8f535c8142d5e4e5b73ac7b0fe62a..bfaa657a2e24e119397920b23b1e78b16dea3f6e 100644 (file)
@@ -76,6 +76,14 @@ Anything else means restrict to WINDOW's frame."
 (defun minibuffer-window-active-p (window)
   "Return t if WINDOW (a minibuffer window) is now active."
   (eq window (active-minibuffer-window)))
+
+(defmacro save-selected-window (&rest body)
+  "Execute BODY, then select the window that was selected before BODY."
+  (list 'let
+       '((save-selected-window-window (selected-window)))
+       (list 'unwind-protect
+             (cons 'progn body)
+             (list 'select-window 'save-selected-window-window)))) 
 \f
 (defun count-windows (&optional minibuf)
    "Returns the number of visible windows.