[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] trunk r115556: * lisp/desktop.el (desktop-auto-save-timeou
From: |
Juri Linkov |
Subject: |
[Emacs-diffs] trunk r115556: * lisp/desktop.el (desktop-auto-save-timeout): Change default to |
Date: |
Mon, 16 Dec 2013 21:48:55 +0000 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 115556
revision-id: address@hidden
parent: address@hidden
fixes bug: http://debbugs.gnu.org/15331
committer: Juri Linkov <address@hidden>
branch nick: trunk
timestamp: Mon 2013-12-16 23:48:51 +0200
message:
* lisp/desktop.el (desktop-auto-save-timeout): Change default to
`auto-save-timeout'. Doc fix.
(desktop-save): Skip the timestamp in desktop-saved-frameset
when checking for auto-save changes.
(desktop-auto-save): Don't call desktop-auto-save-set-timer since
`desktop-auto-save' is called repeatedly by the idle timer.
(desktop-auto-save-set-timer): Replace `run-with-timer' with
`run-with-idle-timer' and a non-nil arg REPEAT. Doc fix.
modified:
etc/NEWS news-20100311060928-aoit31wvzf25yr1z-1
lisp/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-1432
lisp/desktop.el desktop.el-20091113204419-o5vbwnq5f7feedwu-591
=== modified file 'etc/NEWS'
--- a/etc/NEWS 2013-12-16 02:24:08 +0000
+++ b/etc/NEWS 2013-12-16 21:48:51 +0000
@@ -398,8 +398,8 @@
** Desktop
-*** `desktop-auto-save-timeout' defines the number of seconds between
-auto-saves of the desktop.
+*** `desktop-auto-save-timeout' defines the number of seconds idle time
+before auto-save of the desktop.
*** `desktop-restore-frames', enabled by default, allows saving and
restoring the frame/window configuration (frameset). Additional options
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2013-12-16 20:32:15 +0000
+++ b/lisp/ChangeLog 2013-12-16 21:48:51 +0000
@@ -1,5 +1,17 @@
2013-12-16 Juri Linkov <address@hidden>
+ * desktop.el (desktop-auto-save-timeout): Change default to
+ `auto-save-timeout'. Doc fix.
+ (desktop-save): Skip the timestamp in desktop-saved-frameset
+ when checking for auto-save changes.
+ (desktop-auto-save): Don't call desktop-auto-save-set-timer since
+ `desktop-auto-save' is called repeatedly by the idle timer.
+ (desktop-auto-save-set-timer): Replace `run-with-timer' with
+ `run-with-idle-timer' and a non-nil arg REPEAT. Doc fix.
+ (Bug#15331)
+
+2013-12-16 Juri Linkov <address@hidden>
+
* isearch.el (isearch-mode-map): Remove [escape] key bindinds.
(Bug#16035)
(isearch-pre-command-hook): Check `this-command' for symbolp.
=== modified file 'lisp/desktop.el'
--- a/lisp/desktop.el 2013-10-13 00:31:19 +0000
+++ b/lisp/desktop.el 2013-12-16 21:48:51 +0000
@@ -191,9 +191,9 @@
:group 'desktop
:version "22.1")
-(defcustom desktop-auto-save-timeout nil
- "Number of seconds between auto-saves of the desktop.
-Zero or nil means disable timer-based auto-saving."
+(defcustom desktop-auto-save-timeout auto-save-timeout
+ "Number of seconds idle time before auto-save of the desktop.
+Zero or nil means disable auto-saving due to idleness."
:type '(choice (const :tag "Off" nil)
(integer :tag "Seconds"))
:set (lambda (symbol value)
@@ -992,12 +992,21 @@
(insert ")\n\n"))))
(setq default-directory desktop-dirname)
- ;; If auto-saving, avoid writing if nothing has changed since the
last write.
- ;; Don't check 300 characters of the header that contains the
timestamp.
- (let ((checksum (and auto-save (md5 (current-buffer)
- (+ (point-min) 300) (point-max)
- 'emacs-mule))))
- (unless (and auto-save (equal checksum desktop-file-checksum))
+ ;; When auto-saving, avoid writing if nothing has changed since the
last write.
+ (let* ((beg (and auto-save
+ (save-excursion
+ (goto-char (point-min))
+ ;; Don't check the header with changing timestamp
+ (and (search-forward "Global section" nil t)
+ ;; Also skip the timestamp in
desktop-saved-frameset
+ ;; if it's saved in the first non-header line
+ (search-forward "desktop-saved-frameset"
+ (line-beginning-position 3) t)
+ ;; This is saved after the timestamp
+ (search-forward (format "%S" desktop--app-id)
nil t))
+ (point))))
+ (checksum (and beg (md5 (current-buffer) beg (point-max)
'emacs-mule))))
+ (unless (and checksum (equal checksum desktop-file-checksum))
(let ((coding-system-for-write 'emacs-mule))
(write-region (point-min) (point-max) (desktop-full-file-name)
nil 'nomessage))
(setq desktop-file-checksum checksum)
@@ -1199,21 +1208,21 @@
;; Save only to own desktop file.
(eq (emacs-pid) (desktop-owner))
desktop-dirname)
- (desktop-save desktop-dirname nil t))
- (desktop-auto-save-set-timer))
+ (desktop-save desktop-dirname nil t)))
(defun desktop-auto-save-set-timer ()
- "Reset the auto-save timer.
+ "Set the auto-save timer.
Cancel any previous timer. When `desktop-auto-save-timeout' is a positive
-integer, start a new timer to call `desktop-auto-save' in that many seconds."
+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))
(when (and (integerp desktop-auto-save-timeout)
(> desktop-auto-save-timeout 0))
(setq desktop-auto-save-timer
- (run-with-timer desktop-auto-save-timeout nil
- 'desktop-auto-save))))
+ (run-with-idle-timer desktop-auto-save-timeout t
+ 'desktop-auto-save))))
;; ----------------------------------------------------------------------------
;;;###autoload
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] trunk r115556: * lisp/desktop.el (desktop-auto-save-timeout): Change default to,
Juri Linkov <=