+2014-02-07 Juri Linkov <juri@jurta.org>
+
+ * desktop.el (desktop-save-mode): Call `desktop-auto-save-set-timer'
+ when enabling, and `desktop-auto-save-cancel-timer' when disabling.
+ (desktop-auto-save-cancel-timer): New function with some code from
+ `desktop-auto-save-set-timer'.
+ (after-init-hook): Don't call `desktop-auto-save-set-timer'.
+ Instead of setting `desktop-save-mode' to nil, call
+ `desktop-save-mode' with arg 0. (Bug#16630)
+
2014-02-07 Glenn Morris <rgm@gnu.org>
* hi-lock.el (hi-lock-auto-select-face, hi-lock-line-face-buffer)
one session to another. See variable `desktop-save' and function
`desktop-read' for details."
:global t
- :group 'desktop)
+ :group 'desktop
+ (if desktop-save-mode
+ (desktop-auto-save-set-timer)
+ (desktop-auto-save-cancel-timer)))
(defun desktop-save-mode-off ()
"Disable `desktop-save-mode'. Provided for use in hooks."
Cancel any previous timer. When `desktop-auto-save-timeout' is a positive
integer, start a new idle timer to call `desktop-auto-save' repeatedly
after that many seconds of idle time."
- (when desktop-auto-save-timer
- (cancel-timer desktop-auto-save-timer)
- (setq desktop-auto-save-timer nil))
+ (desktop-auto-save-cancel-timer)
(when (and (integerp desktop-auto-save-timeout)
(> desktop-auto-save-timeout 0))
(setq desktop-auto-save-timer
(run-with-idle-timer desktop-auto-save-timeout t
'desktop-auto-save))))
+(defun desktop-auto-save-cancel-timer ()
+ (when desktop-auto-save-timer
+ (cancel-timer desktop-auto-save-timer)
+ (setq desktop-auto-save-timer nil)))
+
;; ----------------------------------------------------------------------------
;;;###autoload
(defun desktop-revert ()
(let ((key "--no-desktop"))
(when (member key command-line-args)
(setq command-line-args (delete key command-line-args))
- (setq desktop-save-mode nil)))
+ (desktop-save-mode 0)))
(when desktop-save-mode
(desktop-read)
- (desktop-auto-save-set-timer)
(setq inhibit-startup-screen t))))
;; So we can restore vc-dir buffers.