From: Jim Porter <jporterbugs@gmail.com>
To: Gregory Heytings <gregory@heytings.org>
Cc: 51377@debbugs.gnu.org
Subject: bug#51377: Automatically exit server when it has no remaining clients
Date: Mon, 25 Oct 2021 11:21:59 -0700 [thread overview]
Message-ID: <35f9b78b-c698-d92b-d6bb-fc6392944b7b@gmail.com> (raw)
In-Reply-To: <90ba36dccc0584692d36@heytings.org>
On 10/24/2021 2:37 PM, Gregory Heytings wrote:
> I see. We have different mental models, I guess. From my viewpoint the
> Emacs server should stay there until it's not necessary, and I'd be
> surprised to be queried about what to do with buffers opened of
> processes started in a frame I already closed when I want to close
> another frame. But of course I do not object to have both behaviors.
[snip]
>
> I attach a patch for that other behavior, it works fine AFAICS.
There are a few issues that I found when doing this previously:
1) I think it should check whether there are other *clients*, not other
*frames*. One client might have multiple frames open, and `C-x C-c'
closes all frames for the current client. If there's only one client
left, but it has two frames open, it should still kill the server, since
there will be no more (non-daemon) frames after `C-x C-c'. (Also, it
should check `(daemonp)', since this logic doesn't apply to a client of
a non-daemon Emacs.)
2) When killing the Emacs daemon from the last client,
`server-kill-emacs-query-function' (probably) doesn't need to warn you
that there are still clients. There's only the one client remaining,
which the user already intends to kill (albeit indirectly, by killing
the daemon).
3) `handle-delete-frame' (used when clicking the X button in your window
manager) can also call `save-buffers-kill-emacs' if the user closed the
last frame. The logic here should exclude the daemon frame from counting
as another frame so that closing all frames via the window manager stops
the daemon too.
I did the above in my patch[1], which could be modified pretty easily to
use the `server-stop-when-closing-last-frame' option you added in your
patch. There might be other cases I haven't accounted for, but it's
working so far in my local configuration.
[1] https://lists.gnu.org/archive/html/bug-gnu-emacs/2021-10/msg02209.html
next prev parent reply other threads:[~2021-10-25 18:21 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-24 15:15 bug#51377: Automatically exit server when it has no remaining clients Gregory Heytings
2021-10-24 16:03 ` Jim Porter
2021-10-24 16:14 ` Jim Porter
2021-10-24 16:32 ` Gregory Heytings
2021-10-24 18:08 ` Jim Porter
2021-10-24 18:43 ` Gregory Heytings
2021-10-24 19:39 ` Jim Porter
2021-10-24 20:42 ` Gregory Heytings
2021-10-24 21:19 ` Jim Porter
2021-10-24 21:37 ` Gregory Heytings
2021-10-25 18:21 ` Jim Porter [this message]
2021-10-26 10:37 ` Gregory Heytings
2021-10-26 11:59 ` Gregory Heytings
2021-10-26 15:07 ` Gregory Heytings
2021-11-11 5:43 ` Lars Ingebrigtsen
2021-10-24 21:40 ` Jim Porter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=35f9b78b-c698-d92b-d6bb-fc6392944b7b@gmail.com \
--to=jporterbugs@gmail.com \
--cc=51377@debbugs.gnu.org \
--cc=gregory@heytings.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.