GNU bug report logs - #51993
29.0.50; [PATCH] Killing emacsclient terminal with `server-stop-automatically' doesn't prompt to save files

Previous Next

Package: emacs;

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


View this message in rfc822 format

From: Jim Porter <jporterbugs <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: larsi <at> gnus.org, 51993 <at> debbugs.gnu.org, gregory <at> heytings.org
Subject: bug#51993: 29.0.50; [PATCH] Killing emacsclient terminal with `server-stop-automatically' doesn't prompt to save files
Date: Wed, 19 Oct 2022 20:14:38 -0700
On 10/9/2022 11:04 PM, Eli Zaretskii wrote:
>> Date: Sun, 9 Oct 2022 15:09:15 -0700
>> From: Jim Porter <jporterbugs <at> gmail.com>
>> Cc: Eli Zaretskii <eliz <at> gnu.org>, 51993 <at> debbugs.gnu.org
>>
>> The patch adds two new hooks: 'server-before-delete-client-functions'
>> and 'server-after-delete-client-functions'. These should give people the
>> ability to add whatever behaviors they think make sense when closing an
>> emacsclient connection. The default behavior is the same as the current
>> default (call 'save-some-buffers' before deleting the client, and do
>> nothing after). To do something like the 'delete-frame' configuration of
>> the current 'server-stop-automatically' API, you might do something like
>> this:
> 
> Isn't this a bit of over-engineering for such a simple problem?  Why
> couldn't we have a user option to decide what to do, and then just do
> it?  The place where we delete client frames is well determined, so
> doing something sensible there should be easy.

I'd be happy with a simple user option, provided we can all agree how 
things should work (or if we can't *all* agree, that you and Lars can 
decide at least). I thought adding a hook might get around the problem 
of not being able to agree, though.

I proposed a couple of behaviors that I described in as much detail as I 
could in the hopes of avoiding confusion and coming to an agreement 
here: 
<https://lists.gnu.org/archive/html/bug-gnu-emacs/2021-11/msg02245.html>.

To summarize it briefly, the behavior I would personally prefer is this. 
When deleting an emacs client by any means (e.g. 'C-x C-c', clicking the 
X on the last frame of a client, etc):

  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.

I'm certainly open to supporting other options if people have different 
preferences, and I can work on a patch to support these so long as we 
come to an agreement/decision/compromise about the expected behavior(s).




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.