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.bugs Subject: bug#55560: 29.0.50; kill-emacs on daemon doesn't remove ~/.emacs.d/.emacs.desktop.lock Date: Sun, 22 May 2022 08:22:41 +0300 Message-ID: <834k1i87ku.fsf@gnu.org> References: <837d6e8y27.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="12721"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 55560@debbugs.gnu.org To: Peter Ludemann Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun May 22 07:24:10 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1nse4Y-00035u-1f for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 22 May 2022 07:24:10 +0200 Original-Received: from localhost ([::1]:33766 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nse4W-0007ve-UZ for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 22 May 2022 01:24:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45110) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nse4Q-0007vQ-Kv for bug-gnu-emacs@gnu.org; Sun, 22 May 2022 01:24:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:49569) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nse4Q-0002zf-Bv for bug-gnu-emacs@gnu.org; Sun, 22 May 2022 01:24:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nse4Q-0003cF-5w for bug-gnu-emacs@gnu.org; Sun, 22 May 2022 01:24:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 22 May 2022 05:24:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 55560 X-GNU-PR-Package: emacs Original-Received: via spool by 55560-submit@debbugs.gnu.org id=B55560.165319698913836 (code B ref 55560); Sun, 22 May 2022 05:24:02 +0000 Original-Received: (at 55560) by debbugs.gnu.org; 22 May 2022 05:23:09 +0000 Original-Received: from localhost ([127.0.0.1]:43466 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nse3Y-0003b6-JN for submit@debbugs.gnu.org; Sun, 22 May 2022 01:23:08 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:51630) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nse3U-0003aL-6N for 55560@debbugs.gnu.org; Sun, 22 May 2022 01:23:06 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:35894) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nse3O-0002uL-Sp; Sun, 22 May 2022 01:22:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=0u9KGNBpSRNMtqaxULj1DnArNceoPGgWBkerE5w8M6U=; b=Z+N+5CXELFfA MQzDi1Z0B9vjpzfF7Ts7y43XB/NWBOOjE/fDvnxjT6UJTB6uhh6BgBtIb0Jmr8O4zTTXlogH4XiZa hBhIQmcNufaoMtmZ7Q5ZH3gLwHTpXoK8OAWeScl/X3HRA6Nb6P0dCGsqgg43EOHLQyaJuf6bKvkV8 5WI+hbObiCRY473naSJ/86zpGw0BuNoMzi9udWL4SZdErr/Oxy7XthtIfiPkYhhaNfdb15oB4o1fX 9b3wEKPjAlulkisSQyROB58QWak0WY1oFVxJJ2wRnucTPKLIuZgxNAlpUvl4MAwycMfL2IRZ8CKj/ 7oSeDUrSMCLclh5NR/xswg==; Original-Received: from [87.69.77.57] (port=1969 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 1nse3O-0006Kd-5l; Sun, 22 May 2022 01:22:58 -0400 In-Reply-To: (message from Peter Ludemann on Sat, 21 May 2022 13:43:42 -0700) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:232863 Archived-At: > From: Peter Ludemann > Date: Sat, 21 May 2022 13:43:42 -0700 > Cc: 55560@debbugs.gnu.org > > The various wikis are somewhat out of date. For example, this shows how to create custom functions that do > what save-buffers-kill-emacs does: https://www.emacswiki.org/emacs/EmacsAsDaemon Feel free to update that. We don't maintain the Wiki, so it is quite likely to be outdated. > Also, the documentation for kill-buffers and save-buffers-kill-emacs makes no mention of the lock file. It isn't useful to mention there any functions that some package adds to the corresponding hooks: there are too many of them, and most aren't relevant for any particular user. Also, where we delete the lock file is an internal implementation detail, so I'm not sure it will be useful to mention it anywhere. If you or someone else wants to see how this stuff works, I recommend reading the source code. That's what I did when I investigated your report. > Anyway, when I do "emacs --daemon -Q", "emacsclient -e 'save-buffers-kill-emacs'" worked fine; but when I > run the daemon without the "-Q", the "emacs -e 'save-buffers-kill-emacs'" command just sits there with no > output. The problem seems to be that I have this in my .emacs: > > (setq kill-emacs-query-functions > (cons (lambda () (yes-or-no-p "Really kill Emacs? ")) > kill-emacs-query-functions)) > > which sets kill-emacs-query-functions to: > ((lambda nil > (yes-or-no-p "Really kill Emacs? ")) > desktop-kill) > > [I don't know where the "desktop-kill" comes from] desktop.el adds desktop-kill to kill-emacs-query-functions. > I often accidentally do ^X-^C when I run emacs in non-daemon mode, so I'd like to keep this hook, or > something similar. Is there a better way of getting an "are you sure" message that works with both daemon > and non-daemon? You can test for the daemon session using the function 'daemonp', and make your "are you sure" question behave accordingly. In general, when a daemon session is killed, there should be no interactive questions -- supporting this case was one of the main reasons why we moved the deletion of the lock file from kill-emacs-hook to kill-emacs-query-functions in the first place.