branch: externals/org
commit 95f77669e01d9e483ad41e2496da11c0d3fc5267
Author: Ihor Radchenko <yanta...@posteo.net>
Commit: Ihor Radchenko <yanta...@posteo.net>

    org-persist: Fix loading data with non-matching version
    
    * lisp/org-persist.el (org-persist--find-index): Only match index
    entries that contain _all_ the components of the given COLLECTION.
    For example, when searching for
    `((elisp org-element--cache) (version ,org-element-cache-version))
    container, make sure that the returned value match both "elisp" and
    "version" containers.
---
 lisp/org-persist.el | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/lisp/org-persist.el b/lisp/org-persist.el
index b93e32274e..13e280c4de 100644
--- a/lisp/org-persist.el
+++ b/lisp/org-persist.el
@@ -540,7 +540,15 @@ FORMAT and ARGS are passed to `message'."
                          (and inode (gethash (cons cont (list :inode inode)) 
org-persist--index-hash))
                          (and hash (gethash (cons cont (list :hash hash)) 
org-persist--index-hash))
                          (and key (gethash (cons cont (list :key key)) 
org-persist--index-hash))))
-             (when r (throw :found r))))))))
+             (when (and r
+                        ;; Every element in CONTAINER matches
+                        ;; COLLECTION.
+                        (seq-every-p
+                         (lambda (cont)
+                           (org-persist-collection-let
+                               (member cont container)))
+                         container))
+               (throw :found r))))))))
 
 (defun org-persist--add-to-index (collection &optional hash-only)
   "Add or update COLLECTION in `org-persist--index'.

Reply via email to