Subject: 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 14:44:21 +0200

> Date: Sun, 30 Oct 2022 15:29:30 -0700
> From: Jim Porter <[email-masked]>
> 
>    $ emacs -Q -f server-start
>    $ emacsclient -c foo.txt
> 
>    ;; type some random characters
> 
>    C-x #
>    ;; or...
>    C-x C-c
> 
> In both cases, Emacs will ask to save foo.txt, though the prompts will 
> be slightly different. That's good, since whatever invoked "emacsclient 
> -c foo.txt" is likely waiting for the user to have saved that file.
> 
> However, if you use 'C-x 5 0' instead, that terminates the Emacs client, 
> but *doesn't* prompt to save foo.txt. I think it should prompt in this 
> case too: all three of 'C-x #', 'C-x C-c', and 'C-x 5 0' have the effect 
> (in this simple case) of deleting the Emacs client and returning to the 
> calling process. (A user who wanted to bail out of an Emacs client 
> without saving should use 'sever-edit-abort' instead.)

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?

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.

Thanks.