diff lisp/window.el @ 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 68f6865bee47
children cd0abfdb9e9d
line wrap: on
line diff
--- 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