changeset 83444:00c55c52afd8

Make all frames created in an emacsclient session belong to that client. * lisp/frame.el (make-frame): Also inherit 'client parameter. Don't override explicitly specified values with inherited ones. * server.el (server-delete-client): Delete frames after deleting the tty. Clear 'client parameter before deleting a frame. * server.el (server-handle-delete-frame): Delete the client if this was its last frame. * startup.el (fancy-splash-default-action): Fix typo in comment. git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-484
author Karoly Lorentey <lorentey@elte.hu>
date Mon, 02 Jan 2006 07:50:53 +0000
parents 4d989ab8dad8
children 1b1b0cb2e2a8
files lisp/frame.el lisp/server.el lisp/startup.el
diffstat 3 files changed, 24 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/frame.el	Mon Jan 02 07:43:46 2006 +0000
+++ b/lisp/frame.el	Mon Jan 02 07:50:53 2006 +0000
@@ -681,13 +681,16 @@
     (run-hooks 'before-make-frame-hook)
     (setq frame (funcall frame-creation-function (append parameters (cdr (assq w window-system-default-frame-alist)))))
     (normal-erase-is-backspace-setup-frame frame)
-    ;; Set up the frame-local environment, if needed.
+    ;; Inherit the 'environment and 'client parameters, if needed.
     (when (eq (frame-terminal frame) (frame-terminal oldframe))
-      (let ((env (frame-parameter oldframe 'environment)))
+      (let ((env (frame-parameter oldframe 'environment))
+	    (client (frame-parameter oldframe 'client)))
 	(if (not (framep env))
 	    (setq env oldframe))
-	(if env
-	    (set-frame-parameter frame 'environment env))))
+	(if (and env (not (assq 'environment parameters)))
+	    (set-frame-parameter frame 'environment env))
+	(if (and client (not (assq 'client parameters)))
+	    (set-frame-parameter frame 'client client))))
     (run-hook-with-args 'after-make-frame-functions frame)
     frame))
 
--- a/lisp/server.el	Mon Jan 02 07:43:46 2006 +0000
+++ b/lisp/server.el	Mon Jan 02 07:50:53 2006 +0000
@@ -270,18 +270,21 @@
 			   (server-temp-file-p)))
 	      (kill-buffer (current-buffer))))))
 
+      ;; Delete the client's frames.
+      (unless noframe
+	(dolist (frame (frame-list))
+	  (when (and (frame-live-p frame)
+		     (equal proc (frame-parameter frame 'client)))
+	    ;; Prevent `server-handle-delete-frame' from calling us
+	    ;; recursively.
+	    (set-frame-parameter frame 'client nil)
+	    (delete-frame frame))))
+
       ;; Delete the client's tty.
       (let ((terminal (server-client-get client 'terminal)))
 	(when (eq (terminal-live-p terminal) t)
 	  (delete-terminal terminal)))
 
-      ;; Delete the client's frames.
-      (unless noframe
-	(dolist (frame (frame-list))
-	  (if (and (frame-live-p frame)
-		   (equal (car client) (frame-parameter frame 'client)))
-	      (delete-frame frame))))
-
       ;; Delete the client's process.
       (if (eq (process-status (car client)) 'open)
 	  (delete-process (car client)))
@@ -318,16 +321,12 @@
   (let ((proc (frame-parameter frame 'client)))
     (when (and (frame-live-p frame)
 	       proc
-	       (or (window-system frame)
-		   ;; A terminal device must not yet be deleted if
-		   ;; there are other frames on it.
-		   (< 0 (let ((frame-num 0))
-			  (mapc (lambda (f)
-				  (when (eq (frame-terminal f)
-					    (frame-terminal frame))
-				    (setq frame-num (1+ frame-num))))
-				(frame-list))
-			  frame-num))))
+	       ;; See if this is the last frame for this client.
+	       (< 1 (let ((frame-num 0))
+		      (dolist ((f (frame-list)))
+			(when (eq proc (frame-parameter f 'client))
+			  (setq frame-num (1+ frame-num))))
+		      frame-num)))
       (server-log (format "server-handle-delete-frame, frame %s" frame) proc)
       (server-delete-client proc 'noframe)))) ; Let delete-frame delete the frame later.
 
--- a/lisp/startup.el	Mon Jan 02 07:43:46 2006 +0000
+++ b/lisp/startup.el	Mon Jan 02 07:50:53 2006 +0000
@@ -1299,7 +1299,7 @@
   (if (and (memq 'down (event-modifiers last-command-event))
 	   (eq (posn-window (event-start last-command-event))
 	       (selected-window)))
-      ;; This is a mouse-down event in the spash screen window.
+      ;; This is a mouse-down event in the splash screen window.
       ;; Ignore it and consume the corresponding mouse-up event.
       (read-event)
     (push last-command-event unread-command-events))