X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=lisp%2Fwindow.el;h=fbd0335e3ab79b4b50a091378576c117c0b3ea72;hb=b165c4eb2ef179d98ef747659018f25352d38e1e;hp=cfd37e7b2cd0a14ed227a7103bb6e44fe397d81e;hpb=98a6e4055a1fa624c592ac06f79287d55196ca37;p=chise%2Fxemacs-chise.git.1 diff --git a/lisp/window.el b/lisp/window.el index cfd37e7..fbd0335 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -130,12 +130,14 @@ Any other non-nil value means search all devices." (eq window (active-minibuffer-window))) (defmacro save-selected-window (&rest body) - "Execute BODY, then select the window that was selected before BODY." - `(let ((save-selected-window-window (selected-window))) + "Execute BODY, then select the window that was selected before BODY. +The value returned is the value of the last form in BODY." + (let ((old-window (gensym "ssw"))) + `(let ((,old-window (selected-window))) (unwind-protect (progn ,@body) - (when (window-live-p save-selected-window-window) - (select-window save-selected-window-window))))) + (when (window-live-p ,old-window) + (select-window ,old-window)))))) (defmacro with-selected-window (window &rest body) "Execute forms in BODY with WINDOW as the selected window.