Fixing an issue with emacsclient when run as systemd service

For a couple of months I was stuck not being able to connect to my emacs instance running as systemd service. I was able to connect to it with emacsclient -c (with a GUI frame) but still not able to do so from the terminal, i.e. with emacsclient -t.

Apparently the problem was that lisp/server.el (itself or because of the hooks) disconnects the client if it is not able to find emacs binary on $PATH. Which was the case for me, because I have emacs compiled from source, configured and installed with the ~/.local prefix.

Somehow this does not happen when emacs is run w/o init (emacs -q) and this issue is most probably related to my doom emacs setup.


Note: debugging the issue involved setting the server-log variable to 't and then watching the contents of the *server* buffer.


Published: 2020-03-21