changeset 83372:d2bada79d78c

Don't let server-save-buffers-kill-display unexpectedly kill Emacs on --no-wait's X frames. * lisp/server.el (server-process-filter): Use a dummy client with --no-wait's X frames. (server-save-buffers-kill-display): Explicitly delete frame after deleting its client, in case it was a dummy. git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-412
author Karoly Lorentey <lorentey@elte.hu>
date Sun, 11 Sep 2005 03:51:40 +0000
parents f4766b398a30
children 35ba943c8399
files lisp/server.el
diffstat 1 files changed, 11 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/server.el	Sun Sep 11 03:49:47 2005 +0000
+++ b/lisp/server.el	Sun Sep 11 03:51:40 2005 +0000
@@ -612,7 +612,12 @@
 		  (unless current-frame
 		    (if (fboundp 'x-create-frame)
 			(let ((params (if nowait
-					  nil
+					  ;; Flag frame as client-created, but use a dummy client.
+					  ;; This will prevent the frame from being deleted when
+					  ;; emacsclient quits while also preventing
+					  ;; `server-save-buffers-kill-display' from unexpectedly
+					  ;; killing emacs on that frame.
+					  (list (cons 'client 'nowait))
 					(list (cons 'client proc)))))
 			  (setq frame (make-frame-on-display
 				       (or display
@@ -1052,7 +1057,8 @@
 If emacsclient was started with a list of filenames to edit, then
 only these files will be asked to be saved."
   (interactive "P")
-  (let ((proc (frame-parameter (selected-frame) 'client)))
+  (let ((proc (frame-parameter (selected-frame) 'client))
+	(frame (selected-frame)))
     (if proc
 	(let ((buffers (server-client-get proc 'buffers)))
 	  ;; If client is bufferless, emulate a normal Emacs session
@@ -1062,7 +1068,9 @@
 			     (if buffers
 				 (lambda () (memq (current-buffer) buffers))
 			       t))
-	  (server-delete-client proc))
+	  (server-delete-client proc)
+	  (when (frame-live-p frame)
+	    (delete-frame frame)))
       (save-buffers-kill-emacs))))
 
 (define-key ctl-x-map "#" 'server-edit)