bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#15331: desktop should auto-save on idle time


From: Juri Linkov
Subject: bug#15331: desktop should auto-save on idle time
Date: Tue, 17 Sep 2013 00:18:52 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (x86_64-pc-linux-gnu)

Another problem is that `desktop-saved-frameset' added to the desktop
now prevents auto-saving from detecting whether the contents of the
desktop file changed.  It now auto-saves the desktop always because
`desktop-saved-frameset' now contains a timestamp.

This patch skips these lines with a timestamp, so the remaining
content of the desktop can be checked for changes.

=== modified file 'lisp/desktop.el'
--- lisp/desktop.el     2013-09-15 16:25:02 +0000
+++ lisp/desktop.el     2013-09-16 21:18:39 +0000
@@ -1012,10 +1012,16 @@ (defun desktop-save (dirname &optional r
                (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.
+         ;; When auto-saving, avoid writing if nothing has changed
+         ;; since the last write.  Don't check 10 lines of the header
+         ;; with constantly-changing timestamp and also don't check
+         ;; the first non-header line with desktop-saved-frameset
+         ;; that also contains a timestamp.
          (let ((checksum (and auto-save (md5 (current-buffer)
-                                             (+ (point-min) 300) (point-max)
+                                             (save-excursion
+                                               (goto-char (point-min))
+                                               (line-beginning-position 11))
+                                             (point-max)
                                              'emacs-mule))))
            (unless (and auto-save (equal checksum desktop-file-checksum))
              (let ((coding-system-for-write 'emacs-mule))






reply via email to

[Prev in Thread] Current Thread [Next in Thread]