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 21:23:15 +0200

> Date: Wed, 2 Nov 2022 12:16:30 -0700
> Cc: [email-masked]
> From: Jim Porter <[email-masked]>
> 
> >> 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...
> 
> Sorry if I seem pushy. I really am open to different solutions here, and 
> I just want to present some various options I see to make it 
> possible/easy to adjust the behavior of server.el. My goal is really 
> just to offer what improvements I can to Emacs; if they don't belong, 
> that's ok. I can just use them locally.
> 
> In short, consider my messages/patches as just an offer to help.

Isn't the last suggestion, of having an optional prompt in
server-delete-client, good enough?

> > Why is it important to have the mode turned on?  What can a mode do
> > that we cannot do without a mode?
> 
> If starting the server activates a minor mode, then Emacs can use a 
> minor-mode keymap for server-mode. That would make it easy for users to 
> add keybindings that only take effect when the server is running. In my 
> case, I could locally remap 'delete-frame' to some new function when the 
> server is running, and then I could make that function do exactly what I 
> want. Other users might want to add other keybindings to this keymap 
> (maybe one for 'server-edit-abort').
> 
> In fact, for my purposes, even just having daemon mode call 
> '(server-mode 1)' instead of '(server-start)' would be a good improvement.

I'm fine with doing that, but we must also make sure this mode is
turned on when users invoke server-start interactively.