Comments on EmacsAsDaemon

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:

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

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 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 and 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 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

In the Stopping the Daemon, what does the ‘emacsclient -e ’(client-save-kill-emacs)` do compared to running ‘emacsclient -c -e ’(save-buffers-kill-emacs)’`.

As a newcomer a while back I was looking for something that did what ‘emacsclient -c -e ’(save-buffers-kill-emacs)’` does but when I saw that function I thought I had best wait until I became more experienced.

In the mean time, I did `emacsclient -c` and ran `M-x save-buffers-kill-emacs RET`.

I feel `save-buffers-kill-emacs` would be worth mentioning on this page too.

pcarphin 2021-03-03 03:44 UTC

Please make sure you contribute only your own work. IP numbers are made available via the page history. If you want to keep it a secret, you need to use Tor. See TextFormattingRules for how to format text. See StyleGuide for the suggested writing style on this wiki.

To save this page you must answer this question:

What is the greatest editor out there?