Why does Emacs Server say "Buffer still has clients" when its only open on one client?

StackOverflow https://stackoverflow.com/questions/22615646

  •  20-06-2023
  •  | 
  •  

Question

I have an emacs daemon running with one client that opened a file. I understand the concept behind C-k showing "Buffer still has clients", but why does this happen when the buffer is only open on one client (I only have one client open)?

Does emacs daemon consider the emacs server copy of the buffer another client copy?

Was it helpful?

Solution

The client connection isn't closed with C-k, it's closed with C-x #. So in effect, when you hit C-k you are telling Emacs to kill the buffer without closing the connection. So the 'open client' is the one you're looking at.

OTHER TIPS

The warning is there to prevent you from inadvertently closing a client connection and causing some unintended action to occur in a waiting process. For example, when emacsclient is invoked as an editor from git or mail, closing the connection may result in a commit being made or an email being sent. Even if there is only one frame open, you may be working on multiple buffers and not remember that this particular buffer came from a client request. So emacs shows the warning to say "are you sure you want to kill this buffer? this will also close the client connection."

C-x # is the way to tell emacs "I know this has a client waiting for it. I'm done with it. Please tell the client I'm finished" and skip the warnings.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top