From: Karoly Lorentey Date: Sun, 26 Jun 2005 21:12:57 +0000 (+0000) Subject: Merged from miles@gnu.org--gnu-2005 (patch 447-448) X-Git-Tag: emacs-pretest-23.0.90~11236^2~141^2~240 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=d836b39b818551c04c7e598176d3f26be7abfa5e;p=emacs.git Merged from miles@gnu.org--gnu-2005 (patch 447-448) Patches applied: * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-447 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-448 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-360 --- d836b39b818551c04c7e598176d3f26be7abfa5e diff --cc lisp/subr.el index 113ba4239e0,7b6c56847f9..c7b565d48f5 --- a/lisp/subr.el +++ b/lisp/subr.el @@@ -1734,28 -1738,17 +1738,29 @@@ See also `with-temp-buffer'. (save-selected-window-alist (mapcar (lambda (frame) (list frame (frame-selected-window frame))) (frame-list)))) - (unwind-protect - (progn (select-window ,window 'norecord) - ,@body) - (dolist (elt save-selected-window-alist) - (and (frame-live-p (car elt)) - (window-live-p (cadr elt)) - (set-frame-selected-window (car elt) (cadr elt)))) - (if (window-live-p save-selected-window-window) - (select-window save-selected-window-window 'norecord))))) + (save-current-buffer + (unwind-protect + (progn (select-window ,window 'norecord) + ,@body) + (dolist (elt save-selected-window-alist) + (and (frame-live-p (car elt)) + (window-live-p (cadr elt)) + (set-frame-selected-window (car elt) (cadr elt)))) + (if (window-live-p save-selected-window-window) + (select-window save-selected-window-window 'norecord)))))) +(defmacro with-selected-frame (frame &rest body) + "Execute the forms in BODY with FRAME as the selected frame. +The value returned is the value of the last form in BODY. +See also `with-temp-buffer'." + (declare (indent 1) (debug t)) + `(let ((save-selected-frame (selected-frame))) + (unwind-protect + (progn (select-frame ,frame) + ,@body) + (if (frame-live-p save-selected-frame) + (select-frame save-selected-frame))))) + (defmacro with-temp-file (file &rest body) "Create a new buffer, evaluate BODY there, and write the buffer to FILE. The value returned is the value of the last form in BODY.