GNU bug report logs - #58404
29.0.50; [PATCH] When killing Emacs from the last client, don't warn about the session having clients

Previous Next

Package: emacs;

Reported by: Jim Porter <jporterbugs <at> gmail.com>

Date: Sun, 9 Oct 2022 23:33:01 UTC

Severity: normal

Tags: patch

Found in version 29.0.50

Done: Jim Porter <jporterbugs <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Jim Porter <jporterbugs <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 58404 <at> 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 09:43:55 -0700
[Message part 1 (text/plain, inline)]
On 10/10/2022 1:53 AM, Eli Zaretskii wrote:
> It is okay not to prompt when there's no need.  That wasn't the part
> on which I commented, AFAIU.
> 
> You said:
> 
>> On the other hand, I think it *would* be useful to prompt if you're in
>> the last client, but there are other non-client frames.
> 
> I'm saying that no, it will not be useful to prompt in that case: if
> the only frames left are non-client frames, we should not prompt,
> because we don't prompt when there are no client frames to begin with.
> Apologies if I misunderstood the use case.

Ah, I see. In that part of my original message, I wanted to say that 
this was a case where I thought the old code made sense, since it 
prompts the user then. However, I also thought that the prompt message 
could be more informative.

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. In other words, I think 
it would be good for this function to prompt when doing this:

  $ emacs -Q --daemon
  $ emacsclient foo.txt
  $ emacsclient -c bar.txt

  ;; From either frame:
  M-x save-buffers-kill-emacs

Or this:

  $ emacs -Q --daemon
  $ emacsclient foo.txt
  $ emacsclient --no-wait -c bar.txt

  ;; From either frame:
  M-x save-buffers-kill-emacs

Or this:

  $ emacs foo.txt
  M-x server-start
  $ emacsclient -c bar.txt

  ;; From either frame:
  M-x save-buffers-kill-emacs

In all of those cases, the user would have 2 (visible) frames, possibly 
on different displays/terminals. Since they're visually similar, I think 
it makes sense to have similar prompts.

Next, if the user ran 'save-buffers-kill-emacs' a second time in any of 
those examples, it *wouldn't* prompt, since then all the remaining 
frames are associated with a single emacsclient (or no client at all).

Since the use case for this is non-obvious (it actually took me several 
iterations to identify all the possible cases), I updated my patch with 
clearer (to me) code, plus comments explaining the reasoning.
[0001-Don-t-prompt-when-killing-an-Emacs-client-if-it-s-th.patch (text/plain, attachment)]

This bug report was last modified 2 years and 219 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.