On 11/2/2022 11:25 PM, Eli Zaretskii wrote: >> Date: Wed, 2 Nov 2022 15:09:21 -0700 >> Cc: 58909@debbugs.gnu.org >> From: Jim Porter >> >> Ok, here's a patch for that. It just sets the 'server-mode' variable >> (and 'global-minor-modes' to be polite) inside 'server-start'. It would >> probably be more elegant if we could make 'server-start' just call >> '(server-mode)' (instead of the other way around like it is now), but I >> think it would be hard to do that while staying 100% compatible. Does >> this seem ok? > > Yes, but let's wait for a few days before installing to give people > chance to chime in. Sounds good to me. In the meantime, I added some regression tests for my change (see the first attached patch). I'll take a look at adding some more tests for server.el code too (in another bug#, though). I also attached a second patch to show an idea I had: since the first patch adds a minor-mode keymap for 'server-mode' (and ensures that the mode is activated whenever the server is running), we could get rid of the server-specific logic from lisp/files.el. Instead of mapping 'C-x C-c' to 'save-buffers-kill-terminal' all the time, Emacs could map it to 'save-buffers-kill-emacs' by default. Then, when the server is running, remap 'save-buffers-kill-emacs' to 'save-buffers-kill-terminal'. Given that the old code already works, I'm not sure this change is worth the risk (it would be very bad if I made a mistake and broke the ability to exit Emacs). Still, I *think* this should work just the same as the old code, and it helps keep server-specific code inside server.el. I don't have any strong opinions on whether this second patch should get merged (I'm totally fine with throwing it out), but I wanted to show off at least one theoretical benefit of the new keymap.