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.