changeset 1133:960da99ad52b

[xemacs-hg @ 2002-12-02 12:27:18 by michaels] 2002-11-28 Mike Sperber <mike@xemacs.org> * window.el (save-window-excursion): New macro to eventually replace the bytecode instruction of that name. 2002-11-16 Mike Sperber <mike@xemacs.org> * dumped-lisp.el (preloaded-file-list): Move window.el & neighbors further up because other some files further down import macro(s) from it.
author michaels
date Mon, 02 Dec 2002 12:27:20 +0000
parents f709ef7a8a74
children dd61dd14b2a4
files lisp/ChangeLog lisp/dumped-lisp.el lisp/window.el
diffstat 3 files changed, 25 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Sun Dec 01 22:53:15 2002 +0000
+++ b/lisp/ChangeLog	Mon Dec 02 12:27:20 2002 +0000
@@ -1,3 +1,14 @@
+2002-11-28  Mike Sperber <mike@xemacs.org>
+
+	* window.el (save-window-excursion): New macro to eventually
+	replace the bytecode instruction of that name.
+
+2002-11-16  Mike Sperber <mike@xemacs.org>
+
+	* dumped-lisp.el (preloaded-file-list): Move window.el & neighbors
+	further up because other some files further down import macro(s)
+	from it.
+
 2002-11-26  Mike Sperber <mike@xemacs.org>
 
 	* window.el (shrink-window-if-larger-than-buffer): Elide braindead
--- a/lisp/dumped-lisp.el	Sun Dec 01 22:53:15 2002 +0000
+++ b/lisp/dumped-lisp.el	Mon Dec 02 12:27:20 2002 +0000
@@ -40,6 +40,9 @@
 	"process" ;; This is bad. network-streams may not be defined.
 	(when-feature multicast "multicast") ; #+network-streams implicitly true
 	"map-ynp"
+	"undo-stack"
+	"window"		; simple needs `save-window-excursion'
+	"window-xemacs"
 	"simple"
 	"keydefs"		; Before loaddefs so that keymap vars exist.
 	"abbrev"
@@ -68,9 +71,6 @@
 	"isearch-mode"
 	"buffer"
 	"buff-menu"
-	"undo-stack"
-	"window"
-	"window-xemacs"
 	"paths.el"		; don't get confused if paths compiled.
 	"lisp"
 	"page"
--- a/lisp/window.el	Sun Dec 01 22:53:15 2002 +0000
+++ b/lisp/window.el	Mon Dec 02 12:27:20 2002 +0000
@@ -184,6 +184,17 @@
      (select-window ,window)
      ,@body))
 
+(defmacro save-window-excursion (&rest body)
+  "Execute body, preserving window sizes and contents.
+Restores which buffer appears in which window, where display starts,
+as well as the current buffer.
+Does not restore the value of point in current buffer."
+  (let ((window-config (gensym 'window-config)))
+    `(let ((,window-config (current-window-configuration)))
+      (unwind-protect
+	  (progn ,@body)
+	(set-window-configuration ,window-config)))))
+
 (defun count-windows (&optional minibuf)
    "Return the number of visible windows.
 This counts the windows in the selected frame and (if the minibuffer is