emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [PATCH] Merge loaded org-persist index with index file contents


From: Max Nikulin
Subject: Re: [PATCH] Merge loaded org-persist index with index file contents
Date: Sun, 11 Dec 2022 17:07:10 +0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2

On 11/12/2022 14:59, Timothy wrote:
+      (setq org-persist--index combined-index
+            org-persist--index-age (current-time)))))

Please, avoid mixing of system clock and filesystem timestamps.

    (file-attribute-modification-time (file-attributes file))

should be more reliable. See the `org-file-newer-than-p' docstring. In general, I would prefer to avoid relying on timestamps at all, but I am not sure if it is possible to implement in elisp with reasonable efforts. The idea is to save into file header a hash of content (or a random number). To check if file has not been modified, just header is read at first. If hash does not match the value stored in memory then it is necessary to read the whole file.

Another point that I am unsure is if Emacs ensures file locks. If one emacs process writes disk cache file then attempts to read the same file by other emacs instances must be postponed.

Cooperation in respect to disk cache would be an improvement, but it may be tricky to implement it reliably.




reply via email to

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