1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-01-04 11:40:22 +00:00

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
This commit is contained in:
Karoly Lorentey 2004-05-23 02:26:21 +00:00
parent b8299c66e3
commit c3e242d334
2 changed files with 13 additions and 1 deletions

View File

@ -1893,7 +1893,7 @@ This function could be MATCHER in a MATCH-ANCHORED `font-lock-keywords' item."
"with-current-buffer" "with-electric-help"
"with-local-quit" "with-no-warnings"
"with-output-to-string" "with-output-to-temp-buffer"
"with-selected-window" "with-syntax-table"
"with-selected-window" "with-selected-frame" "with-syntax-table"
"with-temp-buffer" "with-temp-file" "with-temp-message"
"with-timeout" "with-timeout-handler") t)
"\\>")

View File

@ -1812,6 +1812,18 @@ See also `with-temp-buffer'."
;; 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.