From 7f77f3c86d920832fe8507a05569e37a3b2793ce Mon Sep 17 00:00:00 2001 From: Karl Heuer Date: Sun, 11 Jun 1995 19:27:57 +0000 Subject: [PATCH] (save-selected-window): New macro. --- lisp/window.el | 8 ++++++++ 1 file changed, 8 insertions(+) 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. -- 2.39.2