comparison lisp/subr.el @ 55828:af9432138635

(with-selected-window): Undo previous change.
author Richard M. Stallman <rms@gnu.org>
date Sat, 29 May 2004 15:23:42 +0000
parents 093305d9b188
children cd90d2110ad4 9fb10038ca55
comparison
equal deleted inserted replaced
55827:c5c73c8c2b3e 55828:af9432138635
1794 "Execute the forms in BODY with WINDOW as the selected window. 1794 "Execute the forms in BODY with WINDOW as the selected window.
1795 The value returned is the value of the last form in BODY. 1795 The value returned is the value of the last form in BODY.
1796 This does not alter the buffer list ordering. 1796 This does not alter the buffer list ordering.
1797 See also `with-temp-buffer'." 1797 See also `with-temp-buffer'."
1798 (declare (indent 1) (debug t)) 1798 (declare (indent 1) (debug t))
1799 `(let ((save-selected-window-window (selected-window))) 1799 ;; Most of this code is a copy of save-selected-window.
1800 `(let ((save-selected-window-window (selected-window))
1801 ;; It is necessary to save all of these, because calling
1802 ;; select-window changes frame-selected-window for whatever
1803 ;; frame that window is in.
1804 (save-selected-window-alist
1805 (mapcar (lambda (frame) (list frame (frame-selected-window frame)))
1806 (frame-list))))
1800 (unwind-protect 1807 (unwind-protect
1801 (progn (select-window ,window 'norecord) 1808 (progn (select-window ,window 'norecord)
1802 ,@body) 1809 ,@body)
1810 (dolist (elt save-selected-window-alist)
1811 (and (frame-live-p (car elt))
1812 (window-live-p (cadr elt))
1813 (set-frame-selected-window (car elt) (cadr elt))))
1803 (if (window-live-p save-selected-window-window) 1814 (if (window-live-p save-selected-window-window)
1804 (select-window save-selected-window-window 'norecord))))) 1815 (select-window save-selected-window-window 'norecord)))))
1805 1816
1806 (defmacro with-temp-file (file &rest body) 1817 (defmacro with-temp-file (file &rest body)
1807 "Create a new buffer, evaluate BODY there, and write the buffer to FILE. 1818 "Create a new buffer, evaluate BODY there, and write the buffer to FILE.