unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#55560: 29.0.50; kill-emacs on daemon doesn't remove ~/.emacs.d/.emacs.desktop.lock
@ 2022-05-21 19:16 Peter Ludemann
  2022-05-21 19:50 ` Eli Zaretskii
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Ludemann @ 2022-05-21 19:16 UTC (permalink / raw)
  To: 55560

[-- Attachment #1: Type: text/plain, Size: 4207 bytes --]

I started emacs with "emacs --daemon". I stopped it with the
"kill-emacs" command. Emacs stopped, but the desktop lock file
remained. Following is the my console (not showing the
"emacs --daemon" command).

I'm pretty sure that older emacsen deleted the lock file
when the daemon was stopped, so this looks like a
regression. If it makes a difference, there was an
existing .emacs.desktop file when I started the daemon.

$ ps auwwwxxx|grep emacs
peter    29376  4.1  0.4 135876 68624 ?        Ss   11:30   0:05 emacs
--daemon
peter    29855  0.0  0.0   6180   728 pts/0    S+   11:33   0:00 grep emacs
$ cat ~/.emacs.d/.emacs.desktop.lock ;echo
29376
$ emacsclient -e '(kill-emacs)'
$ ps auwwwxxx|grep emacs
peter    29861  0.0  0.0   6180   664 pts/0    S+   11:33   0:00 grep emacs
$ cat ~/.emacs.d/.emacs.desktop.lock ;echo
29376


In GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, X toolkit, Xaw3d scroll
bars)
 of 2022-05-21 built on penguin
Repository revision: 208102fa470e3417320062cdb48a9967d80bf092
Repository branch: master
System Description: Debian GNU/Linux 11 (bullseye)

Configured using:
 'configure --prefix=/home/peter/.local --with-gnutls
 PKG_CONFIG_PATH=/home/peter/.local/lib/pkgconfig:'

Configured features:
FREETYPE GIF GMP GNUTLS JPEG LIBXML2 MODULES NOTIFY INOTIFY PDUMPER PNG
SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS X11 XAW3D XDBE
XFT XIM XPM LUCID ZLIB

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Apropos

Minor modes in effect:
  global-auto-revert-mode: t
  display-time-mode: t
  savehist-mode: t
  desktop-save-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  buffer-read-only: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
~/src/pykythe/emacs/prolog hides
/home/peter/.local/share/emacs/29.0.50/lisp/progmodes/prolog

Features:
(shadow sort mail-extr emacsbug message yank-media rmc puny dired
dired-loaddefs rfc822 mml mml-sec epa derived epg rfc6068 epg-config
gnus-util mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev
gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util
mail-prsvr mail-utils shortdoc help-fns radix-tree misearch
multi-isearch mule-util apropos time-date term/xterm xterm finder-inf
package browse-url url url-proxy url-privacy url-expand url-methods
url-history url-cookie url-domsuf url-util mailcap url-handlers
url-parse auth-source cl-seq eieio eieio-core cl-macs eieio-loaddefs
password-cache json map url-vars cl-extra help-mode seq gv subr-x
byte-opt bytecomp byte-compile cconv autorevert filenotify grep compile
text-property-search comint ansi-color ring cus-load time savehist
desktop frameset cl-loaddefs cl-lib iso-transl tooltip eldoc paren
electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel
term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image
regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode
prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu
timer select scroll-bar mouse jit-lock font-lock syntax font-core
term/tty-colors frame minibuffer nadvice simple cl-generic cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese composite emoji-zwj charscript charprop
case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure
cl-preloaded button loaddefs faces cus-face macroexp files window
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget keymap hashtable-print-readable backquote threads inotify
dynamic-setting font-render-setting x-toolkit x multi-tty
make-network-process emacs)

Memory information:
((conses 16 91186 8875)
 (symbols 48 9960 1)
 (strings 32 29163 1620)
 (string-bytes 1 904097)
 (vectors 16 15493)
 (vector-slots 8 175522 6636)
 (floats 8 79 477)
 (intervals 56 533 0)
 (buffers 992 12))

[-- Attachment #2: Type: text/html, Size: 5017 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#55560: 29.0.50; kill-emacs on daemon doesn't remove ~/.emacs.d/.emacs.desktop.lock
  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
  0 siblings, 1 reply; 4+ messages in thread
From: Eli Zaretskii @ 2022-05-21 19:50 UTC (permalink / raw)
  To: Peter Ludemann; +Cc: 55560

> From: Peter Ludemann <peter.ludemann@gmail.com>
> Date: Sat, 21 May 2022 12:16:50 -0700
> 
> I started emacs with "emacs --daemon". I stopped it with the
> "kill-emacs" command. Emacs stopped, but the desktop lock file
> remained. Following is the my console (not showing the
> "emacs --daemon" command).
> 
> I'm pretty sure that older emacsen deleted the lock file 
> when the daemon was stopped, so this looks like a 
> regression. If it makes a difference, there was an 
> existing .emacs.desktop file when I started the daemon.

This was a deliberate change in Emacs 28.1: the function that deletes
the desktop lock file is now on kill-emacs-query-functions, and that
hook is not called from kill-emacs (because kill-emacs isn't supposed
to prompt the user, and desktop-kill sometimes need to prompt).

Why are you stopping Emacs will kill-emacs?  The right way of doing
that is to invoke save-buffers-kill-emacs instead, which _will_ delete
the desktop lock file.





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#55560: 29.0.50; kill-emacs on daemon doesn't remove ~/.emacs.d/.emacs.desktop.lock
  2022-05-21 19:50 ` Eli Zaretskii
@ 2022-05-21 20:43   ` Peter Ludemann
  2022-05-22  5:22     ` Eli Zaretskii
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Ludemann @ 2022-05-21 20:43 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 55560

[-- Attachment #1: Type: text/plain, Size: 1089 bytes --]

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

Also, the documentation for kill-buffers and save-buffers-kill-emacs makes
no mention of the lock file.

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]

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?

[-- Attachment #2: Type: text/html, Size: 2426 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#55560: 29.0.50; kill-emacs on daemon doesn't remove ~/.emacs.d/.emacs.desktop.lock
  2022-05-21 20:43   ` Peter Ludemann
@ 2022-05-22  5:22     ` Eli Zaretskii
  0 siblings, 0 replies; 4+ messages in thread
From: Eli Zaretskii @ 2022-05-22  5:22 UTC (permalink / raw)
  To: Peter Ludemann; +Cc: 55560

> 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.





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-05-22  5:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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

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).