From: Jim Porter <jporterbugs@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 58404@debbugs.gnu.org
Subject: bug#58404: 29.0.50; [PATCH] When killing Emacs from the last client, don't warn about the session having clients
Date: Mon, 10 Oct 2022 10:49:05 -0700 [thread overview]
Message-ID: <53e0022a-ed95-cfad-fa09-a0d6bacdf86b@gmail.com> (raw)
In-Reply-To: <834jwbhawi.fsf@gnu.org>
[-- Attachment #1: Type: text/plain, Size: 1409 bytes --]
On 10/10/2022 9:59 AM, Eli Zaretskii wrote:
>> Date: Mon, 10 Oct 2022 09:43:55 -0700
>> Cc: 58404@debbugs.gnu.org
>> From: Jim Porter <jporterbugs@gmail.com>
>>
>> Here's why I think prompting then makes sense: when you're in an
>> emacsclient frame and there are other non-client frames (i.e. ones
>> "owned" by the main Emacs process), that looks very similar to the user
>> as when you have a second emacsclient running.
>
> No, there's a very fundamental difference between the two. When there
> are client frames showing buffers, for each client buffer there's a
> process waiting, the process which requested the buffer to be edited.
> That's why we prompt: we don't want to fail those waiting processes.
>
> Non-client frames don't have this problem.
Ok, I think that makes sense. I was hesitant about removing prompts too
aggressively, since I didn't want to open users up to losing some Emacs
state without prompting when they would have gotten a prompt before.
However, you've convinced me that we don't need to worry about
non-client frames since they don't have processes waiting on them.
(Maybe some users would want more prompts in case they accidentally kill
Emacs, but they can always add to 'kill-emacs-query-functions'.)
Attached is a new patch that removes the prompt when called from the
last remaining client. I also expanded the docstring to explain why the
prompt is there.
[-- Attachment #2: 0001-Don-t-prompt-when-killing-an-Emacs-client-if-it-s-th.patch --]
[-- Type: text/plain, Size: 1910 bytes --]
From ea95b409e89c1d87016a36a92070a592b8b2e4d0 Mon Sep 17 00:00:00 2001
From: Jim Porter <jporterbugs@gmail.com>
Date: Sun, 9 Oct 2022 15:53:27 -0700
Subject: [PATCH] Don't prompt when killing an Emacs client if it's the last
client
* lisp/server.el (server-kill-emacs-query-function): Ignore the
current client (if any) when checking for live clients (bug#58404).
---
lisp/server.el | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/lisp/server.el b/lisp/server.el
index 3caa335c4e..15118067e5 100644
--- a/lisp/server.el
+++ b/lisp/server.el
@@ -1589,14 +1589,19 @@ server-done
(server-buffer-done (current-buffer))))
(defun server-kill-emacs-query-function ()
- "Ask before exiting Emacs if it has live clients.
+ "Ask before exiting Emacs if it has other live clients.
A \"live client\" is a client with at least one live buffer
-associated with it."
- (or (not (seq-some (lambda (proc)
- (seq-some #'buffer-live-p
- (process-get proc 'buffers)))
- server-clients))
- (yes-or-no-p "This Emacs session has clients; exit anyway? ")))
+associated with it. These clients were (probably) started by
+external processes that are waiting for some buffers to be
+edited. If there are any other clients, we don't want to fail
+their waiting processes, so ask the user to be sure."
+ (let ((this-client (frame-parameter nil 'client)))
+ (or (not (seq-some (lambda (proc)
+ (unless (eq proc this-client)
+ (seq-some #'buffer-live-p
+ (process-get proc 'buffers))))
+ server-clients))
+ (yes-or-no-p "This Emacs session has other clients; exit anyway? "))))
(defun server-kill-buffer ()
"Remove the current buffer from its clients' buffer list.
--
2.25.1
next prev parent reply other threads:[~2022-10-10 17:49 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-09 23:32 bug#58404: 29.0.50; [PATCH] When killing Emacs from the last client, don't warn about the session having clients Jim Porter
2022-10-10 6:11 ` Eli Zaretskii
2022-10-10 8:08 ` Jim Porter
2022-10-10 8:53 ` Eli Zaretskii
2022-10-10 16:43 ` Jim Porter
2022-10-10 16:59 ` Eli Zaretskii
2022-10-10 17:49 ` Jim Porter [this message]
2022-10-10 17:57 ` Eli Zaretskii
2022-10-10 23:09 ` Jim Porter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=53e0022a-ed95-cfad-fa09-a0d6bacdf86b@gmail.com \
--to=jporterbugs@gmail.com \
--cc=58404@debbugs.gnu.org \
--cc=eliz@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).