I'm considering using emacs as a server (using (server-start)
) but I do not want to use C-x #
to kill buffers. I've heard of the -n
option for emacsclient, but I'm concerned that it may cause unwanted behavior when other programs use emacsclient. I've thought about using this:
(add-hook kill-buffer-hook server-edit)
Would this work?
(add-hook 'kill-buffer-hook #'server-edit)
- but it's worth trying. If it doesn't work, you can remove the function from the hook usingremove-hook
and get back to where you where. – NickD Sep 24 '20 at 4:17server-edit
tokill-buffer-hook
. It would do some potentially unwanted buffer switching whenever you kill a buffer, but otherwise wouldn't change what happens when you kill a buffer. You can kill a buffer normally even if it's serving a client. You get a confirmation prompt; if you want to get rid of the prompt, doing something after that prompt won't help. Please clarify your question: what is your current workflow, which part bothers you, and how do you want Emacs to react differently? – Gilles 'SO- stop being evil' Sep 24 '20 at 11:44C-x #
exactly as well as which uses ofemacsclient
you're concerned with. – Stefan Sep 24 '20 at 14:31C-x #
, but it is inconvenient, and I am likely to accidentally close buffers in other ways very frequently before I get used to it. For example, I have already built up muscle memory forz x
(I use evil-mode). I may be wrong, but I would guess that programs such as git, emacs anywhere, etc. would see emacsclient close and assume I am done editing before I have even begun if I used the-n
flag, recording the wrong information. – Aronurr64 Sep 24 '20 at 15:49