Commit 2b777cd9 authored by Juri Linkov's avatar Juri Linkov

* lisp/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.

Fixes: debbugs:16630
parent 99cf3859
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)
......
......@@ -162,7 +162,10 @@ If Desktop Save mode is enabled, the state of Emacs is saved from
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."
......@@ -1216,15 +1219,18 @@ Called by the timer created in `desktop-auto-save-set-timer'."
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 ()
......@@ -1465,10 +1471,9 @@ If there are no buffers left to create, kill the timer."
(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.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment