From cccba7784d7a5af41b651ab0c29d2339bebc6732 Mon Sep 17 00:00:00 2001 From: Jim Porter Date: Fri, 19 Nov 2021 20:14:33 -0800 Subject: [PATCH 2/2] Don't explicitly delete client frames when killing Emacs anyway This resolves an obscure issue where killing an emacsclient terminal when there were no other frames would fail. Now, killing the terminal properly kills Emacs. * lisp/server (server-start): Add 'noframe' option to avoid deleting frames. (server-force-stop): Pass 'noframe' to 'server-stop'. --- lisp/server.el | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lisp/server.el b/lisp/server.el index e2d20b1b02..ec32da4fdb 100644 --- a/lisp/server.el +++ b/lisp/server.el @@ -609,7 +609,7 @@ server-get-auth-key (server-generate-key))) ;;;###autoload -(defun server-start (&optional leave-dead inhibit-prompt) +(defun server-start (&optional leave-dead inhibit-prompt noframe) "Allow this Emacs process to be a server for client processes. This starts a server communications subprocess through which client \"editors\" can send your editing commands to this Emacs job. @@ -619,6 +619,10 @@ server-start Optional argument LEAVE-DEAD (interactively, a prefix arg) means just kill any existing server communications subprocess. +If NOFRAME is non-nil, let any existing frames associated with a +client process live. This is useful, for example, when killing +Emacs, in which case the frames will die anyway. + If a server is already running, restart it. If clients are running, ask the user for confirmation first, unless optional argument INHIBIT-PROMPT is non-nil. @@ -681,7 +685,7 @@ server-start (setq leave-dead t))) ;; If this Emacs already had a server, clear out associated status. (while server-clients - (server-delete-client (car server-clients))) + (server-delete-client (car server-clients) noframe)) ;; Now any previous server is properly stopped. (if leave-dead (progn @@ -740,7 +744,7 @@ server-start (defun server-force-stop () "Kill all connections to the current server. This function is meant to be called from `kill-emacs-hook'." - (server-start t t)) + (server-start t t 'noframe)) ;;;###autoload (defun server-force-delete (&optional name) -- 2.25.1