]> git.eshelyaron.com Git - emacs.git/commitdiff
Don't have desktop-save-mode query on `M-x kill-emacs'
authorLars Ingebrigtsen <larsi@gnus.org>
Fri, 2 Jul 2021 15:29:10 +0000 (17:29 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Fri, 2 Jul 2021 15:29:23 +0000 (17:29 +0200)
* lisp/desktop.el (noninteractive): Prompting functions should not
be added to `kill-emacs-hook' (bug#28943).
(desktop-kill): Return t so that it can be used from
`kill-emacs-query-functions'.

lisp/desktop.el

index fb7c6c79a1a7eb56ae3ac1f19f0c283cb44471d7..ae8d026acc4b94e64e1e27282bf455af3dc6610c 100644 (file)
@@ -731,7 +731,7 @@ if different)."
 
 ;; ----------------------------------------------------------------------------
 (unless noninteractive
-  (add-hook 'kill-emacs-hook #'desktop-kill))
+  (add-hook 'kill-emacs-query-functions #'desktop-kill))
 
 (defun desktop-kill ()
   "If `desktop-save-mode' is non-nil, do what `desktop-save' says to do.
@@ -759,7 +759,8 @@ is nil, ask the user where to save the desktop."
        (unless (yes-or-no-p "Error while saving the desktop.  Ignore? ")
         (signal (car err) (cdr err))))))
   ;; If we own it, we don't anymore.
-  (when (eq (emacs-pid) (desktop-owner)) (desktop-release-lock)))
+  (when (eq (emacs-pid) (desktop-owner)) (desktop-release-lock))
+  t)
 
 ;; ----------------------------------------------------------------------------
 (defun desktop-list* (&rest args)