Commit 7f118009 authored by Juri Linkov's avatar Juri Linkov
Browse files

* lisp/desktop.el: Activate auto-saving on window configuration changes.

(desktop-save-mode, desktop-auto-save-timeout): Add/remove
`desktop-auto-save-set-timer' to/from `window-configuration-change-hook'.
(desktop-auto-save-set-timer): Change REPEAT arg of
`run-with-idle-timer' from t to nil.
http://lists.gnu.org/archive/html/emacs-devel/2014-06/msg00147.html
parent f4be80b7
2014-06-06 Juri Linkov <juri@jurta.org>
* desktop.el: Activate auto-saving on window configuration changes.
(desktop-save-mode, desktop-auto-save-timeout): Add/remove
`desktop-auto-save-set-timer' to/from `window-configuration-change-hook'.
(desktop-auto-save-set-timer): Change REPEAT arg of
`run-with-idle-timer' from t to nil.
http://lists.gnu.org/archive/html/emacs-devel/2014-06/msg00147.html
2014-06-06 Santiago Payà i Miralta <santiagopim@gmail.com> 2014-06-06 Santiago Payà i Miralta <santiagopim@gmail.com>
   
* vc/vc-hg.el (vc-hg-working-revision): Use "hg parent" and * vc/vc-hg.el (vc-hg-working-revision): Use "hg parent" and
......
...@@ -174,7 +174,10 @@ For further details, see info node `(emacs)Saving Emacs Sessions'." ...@@ -174,7 +174,10 @@ For further details, see info node `(emacs)Saving Emacs Sessions'."
:global t :global t
:group 'desktop :group 'desktop
(if desktop-save-mode (if desktop-save-mode
(desktop-auto-save-set-timer) (when (and (integerp desktop-auto-save-timeout)
(> desktop-auto-save-timeout 0))
(add-hook 'window-configuration-change-hook 'desktop-auto-save-set-timer))
(remove-hook 'window-configuration-change-hook 'desktop-auto-save-set-timer)
(desktop-auto-save-cancel-timer))) (desktop-auto-save-cancel-timer)))
(defun desktop-save-mode-off () (defun desktop-save-mode-off ()
...@@ -207,13 +210,18 @@ determine where the desktop is saved." ...@@ -207,13 +210,18 @@ determine where the desktop is saved."
(defcustom desktop-auto-save-timeout auto-save-timeout (defcustom desktop-auto-save-timeout auto-save-timeout
"Number of seconds idle time before auto-save of the desktop. "Number of seconds idle time before auto-save of the desktop.
The idle timer activates auto-saving only when window configuration changes.
This applies to an existing desktop file when `desktop-save-mode' is enabled. This applies to an existing desktop file when `desktop-save-mode' is enabled.
Zero or nil means disable auto-saving due to idleness." Zero or nil means disable auto-saving due to idleness."
:type '(choice (const :tag "Off" nil) :type '(choice (const :tag "Off" nil)
(integer :tag "Seconds")) (integer :tag "Seconds"))
:set (lambda (symbol value) :set (lambda (symbol value)
(set-default symbol value) (set-default symbol value)
(ignore-errors (desktop-auto-save-set-timer))) (ignore-errors
(if (and (integerp value) (> value 0))
(add-hook 'window-configuration-change-hook 'desktop-auto-save-set-timer)
(remove-hook 'window-configuration-change-hook 'desktop-auto-save-set-timer)
(desktop-auto-save-cancel-timer))))
:group 'desktop :group 'desktop
:version "24.4") :version "24.4")
...@@ -1244,7 +1252,7 @@ after that many seconds of idle time." ...@@ -1244,7 +1252,7 @@ after that many seconds of idle time."
(when (and (integerp desktop-auto-save-timeout) (when (and (integerp desktop-auto-save-timeout)
(> desktop-auto-save-timeout 0)) (> desktop-auto-save-timeout 0))
(setq desktop-auto-save-timer (setq desktop-auto-save-timer
(run-with-idle-timer desktop-auto-save-timeout t (run-with-idle-timer desktop-auto-save-timeout nil
'desktop-auto-save)))) 'desktop-auto-save))))
(defun desktop-auto-save-cancel-timer () (defun desktop-auto-save-cancel-timer ()
......
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