diff 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
line wrap: on
line diff
--- a/lisp/window.el	Mon Aug 13 11:42:27 2007 +0200
+++ b/lisp/window.el	Mon Aug 13 11:43:24 2007 +0200
@@ -130,12 +130,14 @@
   (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.