]> git.eshelyaron.com Git - emacs.git/commitdiff
desktop.el: Conditionally re-enable desktop autosave
authorKelly Dean <kelly@prtime.org>
Mon, 16 Feb 2015 04:18:25 +0000 (04:18 +0000)
committerArtur Malabarba <bruce.connor.am@gmail.com>
Wed, 18 Feb 2015 00:08:51 +0000 (22:08 -0200)
* desktop.el (desktop-read): Conditionally re-enable
desktop autosave. (Bug#19059)

lisp/ChangeLog
lisp/desktop.el

index 4200a7b7dda2391d253abdec1cee85067ba0872a..b3da9dcaadfe616bb0f5c88abbe59128e6df7abb 100644 (file)
@@ -1,3 +1,8 @@
+2015-02-16  Kelly Dean  <kelly@prtime.org>
+
+       * desktop.el (desktop-read): Conditionally re-enable desktop autosave.
+       (Bug#19059)
+
 2015-02-16  Kelly Dean  <kelly@prtime.org>
 
        * help-mode.el (help-do-xref): Prevent duplicated display of Info
index c2724904b5837d21fcb73825968cace787ff7132..b85d8b257a5f624a4acb8758b10dcc5776c473d9 100644 (file)
@@ -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))