[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC] Option to kill `emacs --daemon' when closing the last client f

From: Jim Porter
Subject: Re: [RFC] Option to kill `emacs --daemon' when closing the last client frame
Date: Wed, 20 Oct 2021 13:07:02 -0700

On 10/19/2021 9:36 PM, Tomasz Konojacki wrote:
On Tue, 19 Oct 2021 21:20:35 -0700
Jim Porter <jporterbugs@gmail.com> wrote:

I've been experimenting with using `emacs --daemon' and found one part of it to 
be somewhat surprising. If I set `ALTERNATE_EDITOR' to the empty string and run 
emacsclient, it runs `emacs --daemon' and connects to it; so far so good. But 
when I close the Emacs client, the Emacs daemon sticks around; I'd prefer the 
daemon to stop as well.

You will get that behaviour if you put (server-start) in your init.el
and set --alternate-editor to the emacs binary, not just an empty string.

Right, that's what I currently do. However, I've run into a couple problems that have made me think `emacs --daemon' would be a better solution. Under a non-daemon[1] configuration:

1) `org-protocol://' links don't work if Emacs isn't already running. This is because org-protocol advises `server-visit-files' to detect when a link with that protocol is passed as a file argument on the command line. Since this argument is passed to the "alternate" Emacs, it's not handled in `server-visit-files' and so the org-protocol code never runs.

2) The first place Emacs is opened is the "primary" instance. This isn't usually a problem when you only run Emacs graphically, but if mixing GUI and terminal instances, it'd be nice to allow closing the first instance and keep the others open. For example, if you start editing in a terminal Emacs and open a GUI Emacs client, the GUI Emacs can only live as long as the terminal one.

The first issue is probably fixable for non-daemon configurations, but the second is more fundamental and pushed me over the edge to (trying to) swap to `emacs --daemon'.

- Jim

[1] An "aengel" configuration?

reply via email to

[Prev in Thread] Current Thread [Next in Thread]