From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: [RFC] Option to kill `emacs --daemon' when closing the last client frame Date: Wed, 20 Oct 2021 15:13:14 +0300 Message-ID: <83h7dbc2sl.fsf@gnu.org> References: Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15738"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Jim Porter Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Oct 20 14:14:43 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mdAUV-0003ub-1s for ged-emacs-devel@m.gmane-mx.org; Wed, 20 Oct 2021 14:14:43 +0200 Original-Received: from localhost ([::1]:58674 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mdAUU-0001mk-4F for ged-emacs-devel@m.gmane-mx.org; Wed, 20 Oct 2021 08:14:42 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:43670) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mdASu-0008G1-Sm for emacs-devel@gnu.org; Wed, 20 Oct 2021 08:13:04 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:36048) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mdASt-0000fZ-T1; Wed, 20 Oct 2021 08:13:03 -0400 Original-Received: from [87.69.77.57] (port=1525 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mdASs-0001VK-Cy; Wed, 20 Oct 2021 08:13:02 -0400 In-Reply-To: (message from Jim Porter on Tue, 19 Oct 2021 21:20:35 -0700) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:277436 Archived-At: > From: Jim Porter > Date: Tue, 19 Oct 2021 21:20:35 -0700 > > 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. Unlike "other programs", Emacs doesn't aim to support such use patterns with the ALTERNATE_EDITOR thing. It is supposed to allow the user to invoke emacsclient without knowing whether a server already runs, by starting the server the first time. That is why we don't kill the server when the last client exits: it is against the use case we want to support. We could add an optional command-line argument to do what you want, but I wonder why would that be useful, when we already have kill-emacs.