changeset 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 5182815e0ee1
children b1ded6fb31d1
files lisp/font-lock.el lisp/subr.el
diffstat 2 files changed, 13 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/font-lock.el	Sun May 23 01:53:23 2004 +0000
+++ b/lisp/font-lock.el	Sun May 23 02:26:21 2004 +0000
@@ -1893,7 +1893,7 @@
 		    "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)
 	     "\\>")
--- 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.