GNU bug report logs - #15331
Idle timer for desktop

Previous Next

Package: emacs;

Reported by: Juri Linkov <juri <at> jurta.org>

Date: Tue, 10 Sep 2013 21:06:01 UTC

Severity: wishlist

Tags: patch

Done: Juri Linkov <juri <at> jurta.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Juri Linkov <juri <at> jurta.org>
To: Juanma Barranquero <lekktu <at> gmail.com>
Cc: Sam Steingold <sds <at> gnu.org>, 15331 <at> debbugs.gnu.org
Subject: bug#15331: desktop should auto-save on idle time
Date: Tue, 17 Sep 2013 00:18:52 +0300
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))





This bug report was last modified 11 years and 255 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.