Hi, a suggestion for this page. Start with the big picture – why would one want to run emacs in a daemon? I landed on this page first in google trying to answer that question, and couldn’t find it here. I suggest putting an intro with something along the lines of:
http://devblog.avdi.org/2011/10/27/running-emacs-as-a-server-emacs-reboot-15/
Shawn shawn (at) weirdness (dot) com
– realscrappy 2014-05-12 18:58 UTC
“After that, using emacsclient (or emacsclient -t) will automatically start an emacs in daemon mode and connect to it if one is not found running, and sane programs will know to run emacsclient to start an editor.”
This point is debatable, and so makes the “Simple setup” misleading:
If the emacs daemon isn’t started, either by `emacs --daemon`, or by `M-x server-start` in emacs, then plenty of sane programs – for instance, most bash shells – will not start an editor. They will output, `emacsclient: can’t find socket; have you started the server?`.
– joseph8th 2016-01-19 03:43 UTC
In the section Starting Emacs Daemon with systemd/CentOS, with
ExecStart=/usr/bin/emacs --daemon --user %u ... User=%i
I get emacs running as emacs --daemon --user root
. If I replace ExecStart=/usr/bin/emacs --daemon --user %u
with ExecStart=/usr/bin/emacs --daemon --user %i
then I get emacs --daemon --user arch
as desired. Is it a typo on the wiki page or an issue with my configuration?
– ArchStanton 2019-06-06 14:50 UTC
https://www.freedesktop.org/software/systemd/man/systemd.unit.html#Specifiers says
"%i" Instance name For instantiated units this is the string between the first "@" character and the type suffix. Empty for non-instantiated units. "%u" User name This is the name of the user running the service manager instance. In case of the system manager this resolves to "root".
So I’m guessing --user %i
is the right thing.
– npostavs 2019-06-07 11:54 UTC
It seems that emacs built with gtk can not save things like recentf files when poweroff machine, see https://emacs.stackexchange.com/questions/16567/emacs-cant-save-history-of-recent-visited-files-opened-in-current-session-befor and https://emacs.stackexchange.com/questions/55528/make-emacs-systemd-service-kill-when-logging-out-shutting-down/60754#60754 Solutions I have found is either a. do the save manually. b. add things like this to your .emacs (run-at-time (current-time) 300 ‘recentf-save-list)(from https://emacs.stackexchange.com/questions/55528/make-emacs-systemd-service-kill-when-logging-out-shutting-down/60754#60754) c. don’t bulid emacs with gtk. As for me, on Gentoo, it is to enable useflag “motif” and disable useflag “athena” “gtk” “Xaw3d”.
– C-Entropy 2020-10-14 12:42 UTC