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: Wed, 02 Nov 2022 20:42:20 +0200

> Date: Wed, 2 Nov 2022 11:17:00 -0700
> Cc: [email-masked]
> From: Jim Porter <[email-masked]>
> 
> > 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.)

We cannot have behavior specific to server.el coded outside of
server.el.  So I don't think I understand what you are saying here.
My suggestion is not to add a hook, it is to add a prompt for the user
when the last client frame is deleted, and do it optionally.

> > 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]).

Yes, but you keep pushing...

> 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.

Maybe it's a bug, but then it's really old.

I'm not sure I understand the purpose of this minor mode, and we
ourselves start the server in the daemon mode by a direct call to
server-start.  Also, server-start is a command, and many users (myself
included) invoke it interactively.

Why is it important to have the mode turned on?  What can a mode do
that we cannot do without a mode?