GNU bug report logs - #58909
29.0.50; [WIP PATCH] Deleting the last frame of an emacsclient doesn't ask to save

Previous Next

Package: emacs;

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

Date: Sun, 30 Oct 2022 22:30:02 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: 58909 <at> debbugs.gnu.org
Subject: bug#58909: 29.0.50; [WIP PATCH] Deleting the last frame of an emacsclient doesn't ask to save
Date: Wed, 2 Nov 2022 11:17:00 -0700
First, I just wanted to say thanks for your patience with this. I think 
this discussion has gone on a lot longer than either of us intended. I 
want to emphasize that while I'm not flexible in how my Emacs 
configuration works, I *am* flexible in what actually gets committed to 
Emacs proper. If you think my changes belong in Emacs, then I'll do the 
necessary work to get them in a merge-able state; if not, I can just 
apply them to my local configuration. Thanks again.

On 11/2/2022 10:11 AM, Eli Zaretskii wrote:
>> Date: Wed, 2 Nov 2022 09:36:52 -0700
>> Cc: 58909 <at> debbugs.gnu.org
>> From: Jim Porter <jporterbugs <at> gmail.com>
>>
>> Hm, ok. That means I'd need to make sure 'C-x 5 0' calls something other
>> than 'delete-frame', so that I could add a prompt to it that can prevent
>> deletion of the frame.
> 
> Why?  delete-frame eventually calls a function from server.el, doesn't
> it?  We've been through that already.  Why cannot you do this inside
> that server.el function?
> 
> If that's because you want to support the C-g case, then don't: that
> is a separate problem.

Yeah, this subthread about 'delete-frame' was just to support the C-g 
case. Aside from that, I think doing this inside 'server-delete-client' 
would be fine. However, at least for this bug, adding a hook that runs 
in 'server-delete-client' doesn't add anything that 
'delete-frame-functions' doesn't already allow. ('server-delete-client' 
is called from a hook in 'delete-frame-functions' in this case anyway.)

> Waaaay too complicated for such a simple problem.  Please, let's just
> prompt the user from server-delete-client (and do that under some
> opt-in option), and be done with that.

If you mean adding a defcustom, I thought we'd agreed not to do that 
(see the beginning of your message here[1]). I'm fine with that; if I 
have to write a hook to fix the issue I saw in the original message, I 
don't mind. (Of course, I'm happy to upstream my code if there's 
interest, but if not, that's ok too.) Instead, my goal was just to 
provide the bare minimum of changes to Emacs to enable a user to modify 
this to their liking without relying too heavily on 'advice-add'. :)

Would it make sense (possibly in a separate bug) to at least make sure 
that the 'server-mode' minor mode is always active when the server is 
running? The server.el code sometimes uses 'server-mode' and sometimes 
uses 'server-start', with the end result being that the minor mode may 
or may not be active depending on the way the server was started. That 
seems like a bug all on its own. If just this part were fixed, it would 
go 95% of the way to make it easy for me to make Emacs work just the way 
I like, and without having to make any major changes to Emacs itself. 
This change could be as simple as renaming 'server-start' to 
'server--start', and then have a new 'server-start' that activates the 
minor mode.

[1] https://lists.gnu.org/archive/html/bug-gnu-emacs/2022-10/msg02642.html




This bug report was last modified 1 year and 259 days ago.

Previous Next


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