comparison 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
comparison
equal deleted inserted replaced
1132:f709ef7a8a74 1133:960da99ad52b
181 "Execute forms in BODY with WINDOW as the selected window. 181 "Execute forms in BODY with WINDOW as the selected window.
182 The value returned is the value of the last form in BODY." 182 The value returned is the value of the last form in BODY."
183 `(save-selected-window 183 `(save-selected-window
184 (select-window ,window) 184 (select-window ,window)
185 ,@body)) 185 ,@body))
186
187 (defmacro save-window-excursion (&rest body)
188 "Execute body, preserving window sizes and contents.
189 Restores which buffer appears in which window, where display starts,
190 as well as the current buffer.
191 Does not restore the value of point in current buffer."
192 (let ((window-config (gensym 'window-config)))
193 `(let ((,window-config (current-window-configuration)))
194 (unwind-protect
195 (progn ,@body)
196 (set-window-configuration ,window-config)))))
186 197
187 (defun count-windows (&optional minibuf) 198 (defun count-windows (&optional minibuf)
188 "Return the number of visible windows. 199 "Return the number of visible windows.
189 This counts the windows in the selected frame and (if the minibuffer is 200 This counts the windows in the selected frame and (if the minibuffer is
190 to be counted) its minibuffer frame (if that's not the same frame). 201 to be counted) its minibuffer frame (if that's not the same frame).