unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Peter Ludemann <peter.ludemann@gmail.com>
Cc: 55560@debbugs.gnu.org
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	[thread overview]
Message-ID: <834k1i87ku.fsf@gnu.org> (raw)
In-Reply-To: <CAHjfyZ3MdfvysMz-dxKTdswUC2Wyj7FAb_Pvu4jwfWzMHWVVmw@mail.gmail.com> (message from Peter Ludemann on Sat, 21 May 2022 13:43:42 -0700)

> From: Peter Ludemann <peter.ludemann@gmail.com>
> 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.





      reply	other threads:[~2022-05-22  5:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-21 19:16 bug#55560: 29.0.50; kill-emacs on daemon doesn't remove ~/.emacs.d/.emacs.desktop.lock Peter Ludemann
2022-05-21 19:50 ` Eli Zaretskii
2022-05-21 20:43   ` Peter Ludemann
2022-05-22  5:22     ` Eli Zaretskii [this message]

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=834k1i87ku.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=55560@debbugs.gnu.org \
    --cc=peter.ludemann@gmail.com \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).