From 1e00ee2497be60040a20fccb79633c936ccbe2c7 Mon Sep 17 00:00:00 2001 From: Kelly Dean Date: Mon, 16 Feb 2015 04:18:25 +0000 Subject: [PATCH] desktop.el: Conditionally re-enable desktop autosave * desktop.el (desktop-read): Conditionally re-enable desktop autosave. (Bug#19059) --- lisp/ChangeLog | 5 +++++ lisp/desktop.el | 7 +++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 4200a7b7dda..b3da9dcaadf 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2015-02-16 Kelly Dean + + * desktop.el (desktop-read): Conditionally re-enable desktop autosave. + (Bug#19059) + 2015-02-16 Kelly Dean * help-mode.el (help-do-xref): Prevent duplicated display of Info diff --git a/lisp/desktop.el b/lisp/desktop.el index c2724904b58..b85d8b257a5 100644 --- a/lisp/desktop.el +++ b/lisp/desktop.el @@ -1136,7 +1136,8 @@ It returns t if a desktop file was loaded, nil otherwise." (desktop-buffer-fail-count 0) (owner (desktop-owner)) ;; Avoid desktop saving during evaluation of desktop buffer. - (desktop-save nil)) + (desktop-save nil) + (desktop-autosave-was-enabled)) (if (and owner (memq desktop-load-locked-desktop '(nil ask)) (or (null desktop-load-locked-desktop) @@ -1152,6 +1153,8 @@ Using it may cause conflicts. Use it anyway? " owner))))) ;; Temporarily disable the autosave that will leave it ;; disabled when loading the desktop fails with errors, ;; thus not overwriting the desktop with broken contents. + (setq desktop-autosave-was-enabled + (memq 'desktop-auto-save-set-timer window-configuration-change-hook)) (desktop-auto-save-disable) ;; Evaluate desktop buffer and remember when it was modified. (load (desktop-full-file-name) t t t) @@ -1205,7 +1208,7 @@ Using it may cause conflicts. Use it anyway? " owner))))) (set-window-prev-buffers window nil) (set-window-next-buffers window nil)))) (setq desktop-saved-frameset nil) - (desktop-auto-save-enable) + (if desktop-autosave-was-enabled (desktop-auto-save-enable)) t)) ;; No desktop file found. (let ((default-directory desktop-dirname)) -- 2.39.2