all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@jurta.org>
To: Juanma Barranquero <lekktu@gmail.com>
Cc: Sam Steingold <sds@gnu.org>, 15331@debbugs.gnu.org
Subject: bug#15331: desktop should auto-save on idle time
Date: Tue, 17 Sep 2013 00:18:52 +0300	[thread overview]
Message-ID: <87ioy0sbwt.fsf@mail.jurta.org> (raw)
In-Reply-To: <87d2odu593.fsf@mail.jurta.org> (Juri Linkov's message of "Thu, 12 Sep 2013 23:58:16 +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))






  reply	other threads:[~2013-09-16 21:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-10 20:57 bug#15331: Idle timer for desktop Juri Linkov
2013-09-11 17:23 ` bug#15331: desktop should auto-save on idle time Sam Steingold
2013-09-11 19:45   ` Juri Linkov
2013-09-12  0:56     ` Juanma Barranquero
2013-09-12 20:58       ` Juri Linkov
2013-09-16 21:18         ` Juri Linkov [this message]
2013-12-16 21:49   ` Juri Linkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ioy0sbwt.fsf@mail.jurta.org \
    --to=juri@jurta.org \
    --cc=15331@debbugs.gnu.org \
    --cc=lekktu@gmail.com \
    --cc=sds@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.