From: Karl Heuer Date: Sun, 11 Jun 1995 19:27:57 +0000 (+0000) Subject: (save-selected-window): New macro. X-Git-Tag: emacs-19.34~3675 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=7f77f3c86d920832fe8507a05569e37a3b2793ce;p=emacs.git (save-selected-window): New macro. --- diff --git a/lisp/window.el b/lisp/window.el index 899bbb0bdcc..bfaa657a2e2 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -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)))) (defun count-windows (&optional minibuf) "Returns the number of visible windows.