Doerthous <doerth...@gmail.com> writes:

> I then wrote a draft patch (attached below) to cache the entry position
> to org-id-locations, which give a 10x speedup of org-id-find, see (2).

Thanks!

> +  (let* ((loc (org-id--find-id-location id))
> +         (file (if (consp loc) (car loc) loc))
> +         (pos (if (consp loc) (cdr loc)))
> +      org-agenda-new-buffers where buf)
> +    (cond
> +     ;; When loc is a cons cell, check whether it's valid or not.
> +     ((consp loc)
> +      (setq buf (or (find-buffer-visiting file)
> +                    (find-file-noselect file)))
> +      (with-current-buffer buf
> +        (when (equal (org-entry-get pos "ID") id)

What if FILE is correct, but the file has been edited and the heading
with ID is now at a different place in that file? It would be more
efficient to try searching via `org-id-find-id-in-file' rather than
falling back to full scan in `org-id-update-id-locations'.

-- 
Ihor Radchenko // yantar92,
Org mode maintainer,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>

Reply via email to