Subject: Re: bug#58909: 29.0.50; [WIP PATCH] Deleting the last frame of an emacsclient doesn't ask to save

From: Eli Zaretskii <[email-masked]>
Date: Mon, 31 Oct 2022 20:25:24 +0200

> Date: Mon, 31 Oct 2022 10:36:57 -0700
> Cc: [email-masked]
> From: Jim Porter <[email-masked]>
> 
> On 10/31/2022 5:44 AM, Eli Zaretskii wrote:
> > I'm uneasy with this incompatible behavior change.  I can think of
> > some legitimate use cases where "C-x 5 0" should not prompt, e.g., if
> > the user intends to keep editing the file, and no application is
> > waiting for the client to finish.  Why break such flows?
> 
> Maybe we should add an option like 
> 'server-save-before-deleting-last-frame', in case users prefer the old 
> behavior?

I tend to think we shouldn't change the behavior here, not at all.
Not even as an option.  I see no problem here that we must solve.

> Alternately, we could add a keybinding for 'server-edit-abort'.

Users who need this can easily make a binding for them.  There's no
need to have such a binding by default.

> Still another possibility would be to prompt only when closing a frame 
> by clicking the "X" on the frame's title bar. When using a 
> non-client/server Emacs, doing this prompts the user to save when 
> closing the last frame. ('C-x 5 0' in this case would just error out, 
> since it refuses to delete the last frame.) That's because clicking the 
> X calls 'handle-delete-frame' which calls 'save-buffers-kill-emacs' in 
> that case. Then clicking the "X" would behave similarly when deleting 
> the last frame of a client and deleting the last frame overall.

But "last frame of a client" ≠ "the last frame".  So I see no reason
for a similar behavior.

> > Deleting a frame does no harm as long as Emacs is still up and running
> > after that, so IMO forcing the user to answer such a prompt could be
> > an annoyance.
> 
> I think it does about the same amount of harm as pressing 'C-x C-c' in 
> an emacs client.

How can you say that?  "C-x C-c" kills the entire terminal, whereas
"C-x 5 0" kills just one frame!

> Since my patch only affects the case when there's a single frame for
> the client, both 'C-x C-c' and 'C-x 5 0' would do the same thing
> (aside from prompting): they close the current frame and terminate
> the client connection.

I disagree, sorry.  We are talking about maybe a minor inconvenience
in a pretty special use case.  It is unjustified to change long-time
behavior for such weak reasons.