emacs-orgmode
[Top][All Lists]
Advanced

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

[PATCH] org-macs.el: Do not compare wall time and file modification time


From: Max Nikulin
Subject: [PATCH] org-macs.el: Do not compare wall time and file modification time
Date: Fri, 6 May 2022 23:56:08 +0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.1

Mark Barton to emacs-orgmode, emacs-devel. master 4a1f69ebca 2/2: Use (TICKS . HZ) for current-time etc. Tue, 26 Apr 2022 23:37:50 -0700. https://list.orgmode.org/BF5B9308-3FEF-4DC6-98C9-BFF36F19D36C@gmail.com
>
The change also breaks org-file-newer-than-p function that triggered the
debugger while loading my init that uses org babel.

I think, it should be fixed in the bugfix Org branch. The attached patch is a compromise to some degree, but I do not see a robust solution.

I do not consider current behavior as reliable, however if you would prefer to keep it, the following patch may be used instead:

Paul Eggert to emacs-orgmode. Re: master 4a1f69ebca 2/2: Use (TICKS . HZ) for current-time etc. Wed, 27 Apr 2022 00:39:01 -0700. https://list.orgmode.org/f200c9ab-d1d4-d5a8-24cf-4e1082528fe7@cs.ucla.edu

The changes are not covered by unit tests at least when most babel languages are disabled.

On 30/04/2022 17:56, Max Nikulin wrote:

     (and mtime (not (and time (time-less-p mtime time))))

Treating equality as "newer" would break `org-compile-file', so I changed the condition. Previously it was not a case since file modification time is usually in the past in comparison to current time.

On 30/04/2022 01:10, Paul Eggert wrote:
+  (when-let ((mtime (file-attribute-modification-time (file-attributes file))))
+ (time-less-p time mtime)))

`file-attribute-modification-time' makes code clearer, but it causes
some complications. Formally compatibility with Emacs-25 (e.g.
ubuntu-18.04 LTS bionic) is not required for the "main" branch. Emacs
sources have the "bugfix" Org branch of the stable release though. The
latter still supports Emacs-25, so either the Emacs source tree and the
Org bugfix branch will diverge at this point or it is safer to avoid
`file-attribute-modification-time' till the next major Org release.
Maybe Org maintainers and developers will correct me.

I have found `file-attribute-modification-time' in org-compat.el.

Attachment: 0001-org-macs.el-Do-not-compare-wall-time-and-file-modifi.patch
Description: Text Data


reply via email to

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