From d788fe99272d3563ff88e872bf337b8c198c7c7d Mon Sep 17 00:00:00 2001 From: Ihor Radchenko Date: Wed, 29 Jun 2022 09:06:12 +0800 Subject: [PATCH] org-persist: Remove read cache introduced in f77800c68 * lisp/org-persist.el (org-persist--read-cache): Remove variable. (org-persist-read): (org-persist-write): Do not use `org-persist--read-cache'. Using `sx-hash-equal' as unique key indicating as-read data is not reliable for deeply nested structures like `org-element--cache'. The `sx-hash-equal' returns the same value regardless of the cache contents. See Emacs Bug#56255. --- lisp/org-persist.el | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/lisp/org-persist.el b/lisp/org-persist.el index b16289da7..fd1c7eafd 100644 --- a/lisp/org-persist.el +++ b/lisp/org-persist.el @@ -749,10 +749,6 @@ When ASSOCIATED is `all', unregister CONTAINER everywhere." (remove container (plist-get collection :container))) (org-persist--add-to-index collection)))))) -(defvar org-persist--read-cache (make-hash-table :test #'equal) - "Hash table storing as-read data object hashes. - -This data is used to avoid overwriting unchanged data.") (defvar org-persist--write-cache (make-hash-table :test #'equal) "Hash table storing as-written data objects. @@ -793,7 +789,6 @@ When LOAD? is non-nil, load the data instead of reading." (plist-get collection :container)) (setq data (or (gethash persist-file org-persist--write-cache) (org-persist--read-elisp-file persist-file))) - (puthash persist-file (sxhash-equal data) org-persist--read-cache) (when data (cl-loop for container in (plist-get collection :container) with result = nil @@ -859,8 +854,7 @@ When IGNORE-RETURN is non-nil, just return t on success without calling (data (mapcar (lambda (c) (cons c (org-persist-write:generic c collection))) (plist-get collection :container)))) (puthash file data org-persist--write-cache) - (unless (equal (sxhash-equal data) (gethash file org-persist--read-cache)) - (org-persist--write-elisp-file file data)) + (org-persist--write-elisp-file file data) (or ignore-return (org-persist-read container associated)))))))) (defun org-persist-write-all (&optional associated)