GNU bug report logs -
#58909
29.0.50; [WIP PATCH] Deleting the last frame of an emacsclient doesn't ask to save
Previous Next
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
[Message part 1 (text/plain, inline)]
On 11/2/2022 5:16 AM, Eli Zaretskii wrote:
>> Date: Tue, 1 Nov 2022 15:39:29 -0700
>> From: Jim Porter <jporterbugs <at> gmail.com>
>> Cc: 58909 <at> debbugs.gnu.org
>>
>> Attached is a (hopefully) safer version of my change to 'delete-frame'.
>> In this patch, a hook can only cancel frame deletion if FORCE is
>> non-nil. This way, if there were ever some bug with a hook, you (or some
>> code) can still force-delete the frame.
>
> Sorry, but I still don't like this. We currently call this hook via
> safe_call because we don't want to let the hook prevent the deletion
> of the frame.
>
> I prefer to solve this in server.el, not in lower-level primitives.
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.
Two questions then:
1. If 'delete-frame' is a lower-level primitive, should 'C-x 5 0' call
it directly, or should there be a higher-level function for it to call?
If we had some higher-level function, then user-level commands could
call that, but low-level code could still use 'delete-frame'. This
user-level command would then be able to run some hook that can prevent
deletion of the frame.
2. Since server.el has a minor mode (unsurprisingly named
'server-mode'), maybe one option is to do command remapping. If we remap
'delete-frame' to some new 'server-delete-frame' when 'server-mode' is
active, then this should work. See attached for a quick sketch of how
this would look.
What do you think about one of these?
[0001-WIP-Try-using-a-keymap-for-server-mode.patch (text/plain, attachment)]
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.