unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Po Lu <luangruo@yahoo.com>
Cc: emacs-devel@gnu.org
Subject: Re: master 4a1f69ebca 2/2: Use (TICKS . HZ) for current-time etc.
Date: Tue, 26 Apr 2022 21:10:09 -0700	[thread overview]
Message-ID: <e8dfbe54-1f51-98ef-eb28-acebaca8c996@cs.ucla.edu> (raw)
In-Reply-To: <87wnfb1fgj.fsf@yahoo.com>

[-- Attachment #1: Type: text/plain, Size: 432 bytes --]

On 4/26/22 18:29, Po Lu wrote:

> The change you installed fixes my problem (though I really don't see why
> it did, since nothing is saved.)

desktop-file-modtime's value is saved, and was compared for list 
equality not time equality.

> Also, shouldn't the desktop file version be bumped when the format of
> the time data changes?

Yes, or we could not change the desktop file format. I installed the 
attached to do the latter.

[-- Attachment #2: 0001-Avoid-change-to-desktop-file-format.patch --]
[-- Type: text/x-patch, Size: 2047 bytes --]

From 8c2ea3a7086353ab2e62e70f8fc7567d8cd75f7a Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Tue, 26 Apr 2022 21:03:21 -0700
Subject: [PATCH] Avoid change to desktop file format

* lisp/desktop.el (desktop--get-file-modtime): New function.
(desktop-save, desktop-read): Use it.
---
 lisp/desktop.el | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/lisp/desktop.el b/lisp/desktop.el
index baa3f32970..f41a41c3c3 100644
--- a/lisp/desktop.el
+++ b/lisp/desktop.el
@@ -645,6 +645,14 @@ desktop-file-modtime
   "When the desktop file was last modified to the knowledge of this Emacs.
 Used to detect desktop file conflicts.")
 
+(defun desktop--get-file-modtime ()
+  "Get desktop file modtime, in list form for desktop format version 208."
+  (setq desktop-file-modtime
+	(time-convert (file-attribute-modification-time
+		       (file-attributes
+			(desktop-full-file-name)))
+		      'list)))
+
 (defvar desktop-var-serdes-funs
   (list (list
 	 'mark-ring
@@ -1221,9 +1229,7 @@ desktop-save
 		(write-region (point-min) (point-max) (desktop-full-file-name) nil 'nomessage))
 	      (setq desktop-file-checksum checksum)
 	      ;; We remember when it was modified (which is presumably just now).
-	      (setq desktop-file-modtime (file-attribute-modification-time
-					  (file-attributes
-					   (desktop-full-file-name)))))))))))
+	      (desktop--get-file-modtime))))))))
 
 ;; ----------------------------------------------------------------------------
 ;;;###autoload
@@ -1332,9 +1338,7 @@ desktop-read
                           'window-configuration-change-hook)))
 	    (desktop-auto-save-disable)
 	    ;; Evaluate desktop buffer and remember when it was modified.
-	    (setq desktop-file-modtime (file-attribute-modification-time
-					(file-attributes
-					 (desktop-full-file-name))))
+	    (desktop--get-file-modtime)
 	    (load (desktop-full-file-name) t t t)
 	    ;; If it wasn't already, mark it as in-use, to bother other
 	    ;; desktop instances.
-- 
2.32.0


  reply	other threads:[~2022-04-27  4:10 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <165091562900.12167.2356992007535632125@vcs2.savannah.gnu.org>
     [not found] ` <20220425194030.030A8C01687@vcs2.savannah.gnu.org>
2022-04-26  9:38   ` master 4a1f69ebca 2/2: Use (TICKS . HZ) for current-time etc Lars Ingebrigtsen
2022-04-26 10:20     ` Manuel Uberti
2022-04-26 10:38       ` Po Lu
2022-04-26 14:42         ` Bozhidar Batsov
2022-04-26 20:29         ` Paul Eggert
2022-04-27  0:36           ` Po Lu
2022-04-27  1:18             ` Paul Eggert
2022-04-27  1:29               ` Po Lu
2022-04-27  4:10                 ` Paul Eggert [this message]
2022-04-26 20:28     ` Paul Eggert
2022-04-27 12:17       ` Lars Ingebrigtsen
2022-04-26 23:54     ` Michael Heerdegen
2022-04-27  6:37 Mark Barton
2022-04-27  7:20 ` Po Lu
2022-04-27  7:39 ` Paul Eggert
2022-04-27 16:55   ` Stefan Monnier
2022-04-28 22:27     ` Paul Eggert
2022-04-29 14:22       ` Max Nikulin
2022-04-29 18:10         ` Paul Eggert
2022-04-30 10:56           ` Max Nikulin

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=e8dfbe54-1f51-98ef-eb28-acebaca8c996@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=emacs-devel@gnu.org \
    --cc=luangruo@yahoo.com \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).