The option -a specifies the editor that should be started if there is no emacs server started yet (the so-called "alternate editor). If the empty string is passed, as in the script above, emacs --daemon is run and emacsclient tries to connect to it (see man emacsclient or M-: (info "(emacs) emacsclient Options") within emacs). Unfortunately, in your case, ...


I fixed this by changing ExecStart in the systemd service file to: ExecStart=/usr/bin/emacs --daemon --daemon is equivalent to --bg-daemon, which starts the emacs daemon in the background (disconnects it from a terminal). I'm still unclear on why this works, however.

Only top voted, non community-wiki answers of a minimum length are eligible