unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [RFC] Option to kill `emacs --daemon' when closing the last client frame
@ 2021-10-20  4:20 Jim Porter
  2021-10-20  4:36 ` Tomasz Konojacki
                   ` (3 more replies)
  0 siblings, 4 replies; 29+ messages in thread
From: Jim Porter @ 2021-10-20  4:20 UTC (permalink / raw)
  To: emacs-devel

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.

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 didn't see any options to configure this behavior in Emacs, but 
looking over the code, it shouldn't be that hard for me to write a patch 
to add this as an option. Before I started though, I wanted to see what 
others thought. Is this a behavior others would be interested in? If so, 
are there any other particulars I should take into account in my patch?

- Jim




^ permalink raw reply	[flat|nested] 29+ messages in thread
* Re: [RFC] Option to kill `emacs --daemon' when closing the last client frame
@ 2021-10-25 22:38 Peter Oliver
  0 siblings, 0 replies; 29+ messages in thread
From: Peter Oliver @ 2021-10-25 22:38 UTC (permalink / raw)
  To: emacs-devel

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

The lazy behaviour seems suitable for the new emacsclient.desktop we have in Emacs 28, too.

-- 
Peter Oliver



^ permalink raw reply	[flat|nested] 29+ messages in thread

end of thread, other threads:[~2021-11-08  5:13 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-20  4:20 [RFC] Option to kill `emacs --daemon' when closing the last client frame Jim Porter
2021-10-20  4:36 ` Tomasz Konojacki
2021-10-20 20:07   ` Jim Porter
2021-10-21  6:07     ` Eli Zaretskii
2021-10-22  2:42       ` Jim Porter
2021-10-22  6:41         ` Eli Zaretskii
2021-10-23 20:38           ` Jim Porter
2021-10-20 12:13 ` Eli Zaretskii
2021-10-21  3:43   ` Jim Porter
2021-10-21  7:34     ` Eli Zaretskii
2021-10-22  2:58       ` Jim Porter
2021-10-22 19:51       ` Gregor Zattler
2021-10-23  6:23         ` Eli Zaretskii
2021-10-23  7:45           ` Gregor Zattler
2021-10-23  8:23             ` Eli Zaretskii
2021-10-23 18:41               ` Gregor Zattler
2021-10-25  6:11     ` Jean Louis
2021-10-25 17:18       ` Jim Porter
2021-10-22 11:58 ` Stefan Monnier
2021-10-24 21:49   ` Jim Porter
2021-10-25  6:19   ` Jean Louis
2021-10-25 18:06     ` Jim Porter
2021-10-23 19:57 ` Gregory Heytings
2021-10-24 11:54   ` Gregory Heytings
2021-10-24 15:17     ` Gregory Heytings
2021-11-08  5:13       ` chad
2021-10-25  6:20   ` Jean Louis
2021-10-25  7:37     ` Gregory Heytings
  -- strict thread matches above, loose matches on Subject: below --
2021-10-25 22:38 Peter Oliver

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).