GNU bug report logs -
#51993
29.0.50; [PATCH] Killing emacsclient terminal with `server-stop-automatically' doesn't prompt to save files
Previous Next
Reported by: Jim Porter <jporterbugs <at> gmail.com>
Date: Sat, 20 Nov 2021 04:30: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
Message #71 received at 51993 <at> debbugs.gnu.org (full text, mbox):
On 10/19/2022 11:23 PM, Eli Zaretskii wrote:
>> Date: Wed, 19 Oct 2022 20:14:38 -0700
>> Cc: larsi <at> gnus.org, 51993 <at> debbugs.gnu.org, gregory <at> heytings.org
>> From: Jim Porter <jporterbugs <at> gmail.com>
>>
>> a) if this is not the last client, behave the same as Emacs 28:
>> prompt to save files specified when starting "emacsclient", and then
>> delete that client.
>>
>> b) if this *is* the last client, prompt the user to save everything
>> (as with 'save-buffers-kill-emacs'), and then delete the client + kill
>> the Emacs daemon.
>
> You mean, in b), instead of just deleting the frame and leaving the
> daemon run, you want to shut down Emacs in its entirety, as if the
> user invoked kill-emacs? I'm okay with that as an optional behavior,
> although I myself won't use it, as it's too dangerous.
Almost. I'd like it to be as if the user invoked
'save-buffers-kill-emacs'; that is, before killing Emacs, prompt the
user about everything[1] that might be lost by killing Emacs.
This already exists as an option -- (server-stop-automatically
'delete-frame)[2], but I also find the current behavior too dangerous.
My original message outlines one of the problems with the current
implementation: it changes the behavior of (a) in my description above.
> $ emacs -Q --daemon
> $ emacsclient -a "" -c foo.txt
> $ emacsclient -a "" -c bar.txt
>
> ;; In the first client frame:
> foobar ;; Insert some text
> C-x C-c
> ;; Emacs prompts "Save file /path/to/foo.txt?..."
>
> Now try the above, but call `(server-stop-automatically 'delete-frame)' first (or replace `delete-frame' with `kill-terminal'; it doesn't matter). In this case, Emacs doesn't prompt to save the file.
As mentioned earlier in this bug, I'm open to providing a patch to
support options beyond the one I suggested (quoted at the beginning of
this message), but I want to be sure we agree on what the options should
look like so that I'm not breaking Gregory's (or anyone else's)
preferred behavior here.
(Of course, all of this would remain opt-in. I don't want to change the
default behavior here, since it would break years of established precedent.)
[1] Well, everything that Emacs usually asks about in a non-daemon
configuration, anyway.
[2] It's not hooked up to Customize, though I don't think that would be
too hard to do.
This bug report was last modified 2 years and 164 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.