Release the desktop lock in 'kill-emacs-hook'
* lisp/desktop.el: Run 'desktop--on-kill' in 'kill-emacs-hook'. (desktop--on-kill): New function, refactored from 'desktop-kill'. (desktop-kill): Call 'desktop--on-kill'. (Bug#56800)
This commit is contained in:
parent
4ea1f6c7f8
commit
4be938169d
1 changed files with 9 additions and 3 deletions
|
@ -733,7 +733,10 @@ if different)."
|
||||||
|
|
||||||
;; ----------------------------------------------------------------------------
|
;; ----------------------------------------------------------------------------
|
||||||
(unless noninteractive
|
(unless noninteractive
|
||||||
(add-hook 'kill-emacs-query-functions #'desktop-kill))
|
(add-hook 'kill-emacs-query-functions #'desktop-kill)
|
||||||
|
;; Certain things should be done even if
|
||||||
|
;; `kill-emacs-query-functions' are not called.
|
||||||
|
(add-hook 'kill-emacs-hook #'desktop--on-kill))
|
||||||
|
|
||||||
(defun desktop-kill ()
|
(defun desktop-kill ()
|
||||||
"If `desktop-save-mode' is non-nil, do what `desktop-save' says to do.
|
"If `desktop-save-mode' is non-nil, do what `desktop-save' says to do.
|
||||||
|
@ -760,12 +763,15 @@ is nil, ask the user where to save the desktop."
|
||||||
(file-error
|
(file-error
|
||||||
(unless (yes-or-no-p "Error while saving the desktop. Ignore? ")
|
(unless (yes-or-no-p "Error while saving the desktop. Ignore? ")
|
||||||
(signal (car err) (cdr err))))))
|
(signal (car err) (cdr err))))))
|
||||||
|
(desktop--on-kill)
|
||||||
|
t)
|
||||||
|
|
||||||
|
(defun desktop--on-kill ()
|
||||||
;; If we own it, we don't anymore.
|
;; If we own it, we don't anymore.
|
||||||
(when (eq (emacs-pid) (desktop-owner))
|
(when (eq (emacs-pid) (desktop-owner))
|
||||||
;; Allow exiting Emacs even if we can't delete the desktop file.
|
;; Allow exiting Emacs even if we can't delete the desktop file.
|
||||||
(ignore-error 'file-error
|
(ignore-error 'file-error
|
||||||
(desktop-release-lock)))
|
(desktop-release-lock))))
|
||||||
t)
|
|
||||||
|
|
||||||
;; ----------------------------------------------------------------------------
|
;; ----------------------------------------------------------------------------
|
||||||
(defun desktop-list* (&rest args)
|
(defun desktop-list* (&rest args)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue