aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJim Porter2022-10-09 15:53:27 -0700
committerJim Porter2022-10-10 15:09:21 -0700
commitebc19f56aaeb98b834eea1ce8768ca13bed8578c (patch)
tree80102e7660ae6b31f6f7c9106291ec82e48f1519
parent5df95ba039d93b26b11adcf61646467cd7174740 (diff)
downloademacs-ebc19f56aaeb98b834eea1ce8768ca13bed8578c.tar.gz
emacs-ebc19f56aaeb98b834eea1ce8768ca13bed8578c.zip
Don't prompt when killing an Emacs client if it's the last client
* lisp/server.el (server-kill-emacs-query-function): Ignore the current client (if any) when checking for live clients (bug#58404).
-rw-r--r--lisp/server.el19
1 files changed, 12 insertions, 7 deletions
diff --git a/lisp/server.el b/lisp/server.el
index 3caa335c4eb..90d97c1538e 100644
--- a/lisp/server.el
+++ b/lisp/server.el
@@ -1589,14 +1589,19 @@ specifically for the clients and did not exist before their request for it."
1589 (server-buffer-done (current-buffer)))) 1589 (server-buffer-done (current-buffer))))
1590 1590
1591(defun server-kill-emacs-query-function () 1591(defun server-kill-emacs-query-function ()
1592 "Ask before exiting Emacs if it has live clients. 1592 "Ask before exiting Emacs if it has other live clients.
1593A \"live client\" is a client with at least one live buffer 1593A \"live client\" is a client with at least one live buffer
1594associated with it." 1594associated with it. These clients were (probably) started by
1595 (or (not (seq-some (lambda (proc) 1595external processes that are waiting for some buffers to be
1596 (seq-some #'buffer-live-p 1596edited. If there are any other clients, we don't want to fail
1597 (process-get proc 'buffers))) 1597their waiting processes, so ask the user to be sure."
1598 server-clients)) 1598 (let ((this-client (frame-parameter nil 'client)))
1599 (yes-or-no-p "This Emacs session has clients; exit anyway? "))) 1599 (or (not (seq-some (lambda (proc)
1600 (unless (eq proc this-client)
1601 (seq-some #'buffer-live-p
1602 (process-get proc 'buffers))))
1603 server-clients))
1604 (yes-or-no-p "This Emacs session has other clients; exit anyway? "))))
1600 1605
1601(defun server-kill-buffer () 1606(defun server-kill-buffer ()
1602 "Remove the current buffer from its clients' buffer list. 1607 "Remove the current buffer from its clients' buffer list.