GNU Emacs (x86_64-pc-linux-gnu, GTK+ Version 3.18.9) of 2016-04-25

Xubuntu 16.04, Linux kernel 4.4

In my .emacs I have the following settings

(require 'server)
(unless (server-running-p)

When I call emacsclient -c -a emacs, it works like a charm. When there is no Emacs instance running in background or in another workspace, Emacs will be called. Otherwise, emacsclient will be called.

But I want to have Emacs running in the background. For that, I use the Emacs daemon.

When calling emacs --daemon, I see my dot-emacs being loaded in the terminal. After that, I call emacsclient -c or emacsclient, but it cannot detect the Emacs daemon/server.

When Googling around, I found this answer: http://www.tychoish.com/posts/getting-emacs-daemon-to-work-right/

So I added it to my commands that it will be called on startup:

emacs -u renefroger(my username) --daemon --eval "(setq default-frame-alist \ '((font-backend . \"xft\") (font . \"[FONT]-[SIZE]\")))" -l ~/.emacs

After a restart, I call emacsclient -nw but it makes it somewhat unusable. I got sometimes the message Error reading from stdin when I do sometihing like M-x Helm, and the colors are not right, while they're fine the console Emacs with the Emacs server instead of daemon. So I'm puzzled what's going on with the Emacs daemon.

How could I get Emacs daemon working properly?

  • Have you looked at this emacs.stackexchange.com/a/5454/7045
    – Emacs User
    Commented May 16, 2016 at 21:06
  • Yes, I tried it. But after starting Emacs daemon, the emacsclient also keeps starting the Emacs dameon.
    – ReneFroger
    Commented May 16, 2016 at 22:09
  • Sorry I'm not able to understand your case exactly or how it differs from others with similar issues. I even tried editing your question.
    – Emacs User
    Commented May 16, 2016 at 22:50
  • ReneFroger: I don't really follow the question, but differences between daemon and not-daemon servers are sometimes on account of setting frame- or terminal-local values in your init file before any frame exists. emacs.stackexchange.com/a/16485 should help if you establish that you are indeed doing this.
    – phils
    Commented May 17, 2016 at 4:47
  • I beleive its a bug. I did the test with a clean config in 24.5.1 and I didn't have any issues.
    – Joafigue
    Commented May 19, 2016 at 5:24

1 Answer 1


After bisecting my Emacs configuration, I found the culprit.

Remove the (setq server-socket-dir "your-path") from your configuration.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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