[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: Sun, 24 Oct 2021 14:49:39 -0700

On 10/22/2021 4:58 AM, Stefan Monnier wrote:
This would allow for a behavior similar to other (graphical) programs: if
I run `firefox example.com', it starts a new instance as normal. If I run it
again, it opens a new tab in the existing instance. If I close all the
Firefox windows, all the associated processes terminate.

I guess it would make sense to try and distinguish the two cases:

- Eager: `emacs --daemon` is run (typically from something like a login
   script or systemd) before any emacsclient is involved.
- Lazy: `emacs --daemon` is started on-demand by the `-a` option
   of `emacsclient` (or via ALTERNATE_EDITOR).

In the lazy case, we could kill the daemon when the last client exits.

I posted a series of patches going this route here: <https://lists.gnu.org/archive/html/bug-gnu-emacs/2021-10/msg02184.html> (see also my followups in that bug).

To briefly summarize, I added a `--lazy-daemon' flag that indicates the (background) daemon was started on-demand, and then consult that via a new function `daemon-type' to adjust the behavior. There's probably more work to be done with that (e.g. customization options for users to tweak the behavior to their preferences), but it works for me so far.

Hopefully with actual patches showing what I'd like, it'll be easier for people to see precisely what behavior I'm after. Of course, if no one else has any interest in things working this way, then it might not make sense to merge the patches. No matter what, I can always take the Lisp portions for my own configuration so that things work the way I want.

- Jim

reply via email to

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