comparison lisp/window.el @ 460:223736d75acb r21-2-45

Import from CVS: tag r21-2-45
author cvs
date Mon, 13 Aug 2007 11:43:24 +0200
parents 576fb035e263
children 3e321319c5ba
comparison
equal deleted inserted replaced
459:9d4fd877b885 460:223736d75acb
128 (defun minibuffer-window-active-p (window) 128 (defun minibuffer-window-active-p (window)
129 "Return t if WINDOW (a minibuffer window) is now active." 129 "Return t if WINDOW (a minibuffer window) is now active."
130 (eq window (active-minibuffer-window))) 130 (eq window (active-minibuffer-window)))
131 131
132 (defmacro save-selected-window (&rest body) 132 (defmacro save-selected-window (&rest body)
133 "Execute BODY, then select the window that was selected before BODY." 133 "Execute BODY, then select the window that was selected before BODY.
134 `(let ((save-selected-window-window (selected-window))) 134 The value returned is the value of the last form in BODY."
135 (let ((old-window (gensym "ssw")))
136 `(let ((,old-window (selected-window)))
135 (unwind-protect 137 (unwind-protect
136 (progn ,@body) 138 (progn ,@body)
137 (when (window-live-p save-selected-window-window) 139 (when (window-live-p ,old-window)
138 (select-window save-selected-window-window))))) 140 (select-window ,old-window))))))
139 141
140 (defmacro with-selected-window (window &rest body) 142 (defmacro with-selected-window (window &rest body)
141 "Execute forms in BODY with WINDOW as the selected window. 143 "Execute forms in BODY with WINDOW as the selected window.
142 The value returned is the value of the last form in BODY." 144 The value returned is the value of the last form in BODY."
143 `(save-selected-window 145 `(save-selected-window