2

I am trying to use emacs with a background server running and client instances. To do so, I lauch an emacs daemon with emacs --daemon. Then I open a client session with emacsclient -c. Doing like that and then visiting a file in the client session works fine. However, if I try to directly open a file with emacsclient -c file, there is a "Server" minor mode displayed in the mode line, and when I click on it and choose "Help for minor mode", a frame open with that text :

server-buffer-clients is an alias for `server-buffer-clients',
which is not defined.  Please make a bug report.

Then, if I close the client and open a new client, the file previously opened with emacsclient -c file isn't in the list of current buffers anymore (Ctrl-x b) while they stay in it if I just open a client with emacsclient -c and next visit them.

Why this behavior ? I am doing things wrong ? How to properly use emacs in client/server modes to have a persistent background instance with which I can interact ?

Thanks :-)

PS : I am running emacs-24.5.1 I have also tried that without any customization (with no .emacs and no .emacs.d)

  • How do you close the client? If you use C-x # (server-edit) then this not only closes the client, but also kills the buffer. You can easily try that out in another server window, which will show the buffer as exisiting while the client still is running, and once you close it with C-x # will not have it in the list of buffers any more. – dfeich Feb 18 '16 at 7:16
  • 1
    I am not sure if this is relevant to your issue, but it's possibly you really want to run emacsclient -n -c file instead. Then emacsclient will quit as soon as emacs has opened the file, and the buffer will remain until you kill it explicitly. – Harald Hanche-Olsen Feb 18 '16 at 10:03
  • @HaraldHanche-Olsen Yep this works, thanks – Mathieu Rollet Feb 18 '16 at 13:09
  • @HaraldHanche-Olsen: can you convert your comment to an answer so OP can accept it? – Dan Feb 18 '16 at 13:36
  • @Dan: Okay, done. I didn't at first, since the OP supplied the answer on his own, but perhaps accepting his own answer requires some reputation that he hasn't earned yet. – Harald Hanche-Olsen Feb 18 '16 at 20:34
3

I suspect that you really want to run emacsclient -n -c file instead. Then emacsclient will quit as soon as emacs has opened the file, and the buffer will remain until you kill it explicitly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.