Mercurial > emacs
diff lisp/subr.el @ 83128:2ccd88cfde01
New control structure: with-selected-frame.
lisp/subr.el (with-selected-frame): New macro.
lisp/font-lock.el (lisp-font-lock-keywords-2): Add with-selected-frame.
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-168
author | Karoly Lorentey <lorentey@elte.hu> |
---|---|
date | Sun, 23 May 2004 02:26:21 +0000 |
parents | 30d4272bcc4b |
children | 62cf3d6337a0 |
line wrap: on
line diff
--- a/lisp/subr.el Sun May 23 01:53:23 2004 +0000 +++ b/lisp/subr.el Sun May 23 02:26:21 2004 +0000 @@ -1812,6 +1812,18 @@ ;; This is where the code differs from save-selected-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.