[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#51377: Automatically exit server when it has no remaining clients
From: |
Jim Porter |
Subject: |
bug#51377: Automatically exit server when it has no remaining clients |
Date: |
Mon, 25 Oct 2021 11:21:59 -0700 |
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
- bug#51377: Automatically exit server when it has no remaining clients, Gregory Heytings, 2021/10/24
- bug#51377: Automatically exit server when it has no remaining clients, Jim Porter, 2021/10/24
- bug#51377: Automatically exit server when it has no remaining clients, Jim Porter, 2021/10/24
- bug#51377: Automatically exit server when it has no remaining clients, Gregory Heytings, 2021/10/24
- bug#51377: Automatically exit server when it has no remaining clients, Jim Porter, 2021/10/24
- bug#51377: Automatically exit server when it has no remaining clients, Gregory Heytings, 2021/10/24
- bug#51377: Automatically exit server when it has no remaining clients, Jim Porter, 2021/10/24
- bug#51377: Automatically exit server when it has no remaining clients, Gregory Heytings, 2021/10/24
- bug#51377: Automatically exit server when it has no remaining clients, Jim Porter, 2021/10/24
- bug#51377: Automatically exit server when it has no remaining clients, Gregory Heytings, 2021/10/24
- bug#51377: Automatically exit server when it has no remaining clients,
Jim Porter <=
- bug#51377: Automatically exit server when it has no remaining clients, Gregory Heytings, 2021/10/26
- bug#51377: Automatically exit server when it has no remaining clients, Gregory Heytings, 2021/10/26
- bug#51377: Automatically exit server when it has no remaining clients, Gregory Heytings, 2021/10/26
- bug#51377: Automatically exit server when it has no remaining clients, Jim Porter, 2021/10/24