[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
emacs-28 4be938169d: Release the desktop lock in 'kill-emacs-hook'
From: |
Eli Zaretskii |
Subject: |
emacs-28 4be938169d: Release the desktop lock in 'kill-emacs-hook' |
Date: |
Thu, 28 Jul 2022 02:16:30 -0400 (EDT) |
branch: emacs-28
commit 4be938169d6d1fc7bf0f44b78728f21a65317aed
Author: Paul Pogonyshev <pogonyshev@gmail.com>
Commit: Eli Zaretskii <eliz@gnu.org>
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)
---
lisp/desktop.el | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/lisp/desktop.el b/lisp/desktop.el
index 041dbcf7c1..9cd26646de 100644
--- a/lisp/desktop.el
+++ b/lisp/desktop.el
@@ -733,7 +733,10 @@ if different)."
;; ----------------------------------------------------------------------------
(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 ()
"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
(unless (yes-or-no-p "Error while saving the desktop. Ignore? ")
(signal (car err) (cdr err))))))
+ (desktop--on-kill)
+ t)
+
+(defun desktop--on-kill ()
;; If we own it, we don't anymore.
(when (eq (emacs-pid) (desktop-owner))
;; Allow exiting Emacs even if we can't delete the desktop file.
(ignore-error 'file-error
- (desktop-release-lock)))
- t)
+ (desktop-release-lock))))
;; ----------------------------------------------------------------------------
(defun desktop-list* (&rest args)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- emacs-28 4be938169d: Release the desktop lock in 'kill-emacs-hook',
Eli Zaretskii <=