Subject: Re: bug#2677: 23.0.91; need ability to run emacs --daemon in the foreground

From: Jameson Graef Rollins <[email-masked]>
Date: Mon, 29 Feb 2016 09:22:24 -0800

On Mon, Feb 29 2016, Glenn Morris <[email-masked]> wrote:
> Lars Ingebrigtsen wrote:
>
>> Jameson Rollins <[email-masked]> writes:
>>
>>> This is a feature request more than a bug: I would really like to see
>>> the ability to run the emacs server daemon ("emacs --daemon") in the
>>> foreground.  This would be very useful.  I would like to be able to
>>> start/control this daemon with a service supervisor (i.e. runit [0]).
>>> This would allow me to easily start the daemon on system start up, and
>>> have access to the daemon from all xsessions and virtual terminals.
>>
>> --daemon is a switch for running Emacs in the background.  If you don't
>> want Emacs running in the background, you don't have to do anything in
>> particular.
>
> --daemon _should_ be a switch for running a "headless" Emacs.
> The fact that it forks and runs in the background is not an essential
> condition, and the justification for not doing so is provided in the
> report. See eg "new-style daemons" on
> https://www.freedesktop.org/software/systemd/man/daemon.html
>
> I guess that systemd type = forking should be able to handle current
> Emacs, but the above reference says that "new-style" daemons are
> preferred.

Glenn, than you very much for responding to this and reopening the bug
(I was going to reopen as well).  The issue is as you describe.  There
should at least be a way to operate the emacs server such that it
does not fork, but just runs in a "headless" mode, with logs to stderr.
This is the "new-style" that you're referring to, that is how all modern
init systems handle daemons.

Thanks for the consideration.

jamie.