all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Max Nikulin <manikulin@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: [PATCH] Merge loaded org-persist index with index file contents
Date: Sun, 11 Dec 2022 17:07:10 +0700	[thread overview]
Message-ID: <tn4a4f$235$1@ciao.gmane.io> (raw)
In-Reply-To: <87359mqqvf.fsf@tec.tecosaur.net>

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	other threads:[~2022-12-11 10:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-11  7:59 [PATCH] Merge loaded org-persist index with index file contents Timothy
2022-12-11 10:07 ` Max Nikulin [this message]
2022-12-11 11:26   ` Timothy
2022-12-14 15:07 ` Timothy

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='tn4a4f$235$1@ciao.gmane.io' \
    --to=manikulin@gmail.com \
    --cc=emacs-orgmode@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.