1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-01-19 18:13:55 +00:00

* 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
This commit is contained in:
Juri Linkov 2014-02-07 09:44:29 +02:00
parent 99cf38598c
commit 2b777cd9a2
2 changed files with 21 additions and 6 deletions

View File

@ -1,3 +1,13 @@
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)

View File

@ -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.