branch: externals/org commit e90a8a69a7fa2d83c995b5d32bc0b24a68218ed3 Author: Ihor Radchenko <yanta...@posteo.net> Commit: Ihor Radchenko <yanta...@posteo.net>
org-element-cache: Log recovered persisted elements during loading * lisp/org-element.el (org-element--cache-persist-before-read): (org-element--cache-persist-after-read): Record diagnostics messages when loading persistent cache. --- lisp/org-element.el | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lisp/org-element.el b/lisp/org-element.el index 40bb294795..37c2d201f3 100644 --- a/lisp/org-element.el +++ b/lisp/org-element.el @@ -7368,15 +7368,19 @@ The element is: %S\n The real element is: %S\n Cache around :begin:\n%S\n%S\n%S" (defun org-element--cache-persist-before-read (container &optional associated) "Avoid reading cache before Org mode is loaded." (when (equal container '(elisp org-element--cache)) + (org-element--cache-log-message "Loading persistent cache for %s" (plist-get associated :file)) (if (not (and (plist-get associated :file) (get-file-buffer (plist-get associated :file)))) - 'forbid + (progn + (org-element--cache-log-message "%s does not have a buffer: not loading cache" (plist-get associated :file)) + 'forbid) (with-current-buffer (get-file-buffer (plist-get associated :file)) (unless (and org-element-use-cache org-element-cache-persistent (derived-mode-p 'org-mode) (equal (secure-hash 'md5 (current-buffer)) (plist-get associated :hash))) + (org-element--cache-log-message "Cache is not current (or persistence is disabled) in %s" (plist-get associated :file)) 'forbid))))) (defun org-element--cache-persist-after-read (container &optional associated) @@ -7393,7 +7397,10 @@ The element is: %S\n The real element is: %S\n Cache around :begin:\n%S\n%S\n%S" (lambda (el2) (unless (org-element-type-p el2 'plain-text) (org-element-put-property el2 :buffer (current-buffer)))) - nil nil nil 'with-affiliated 'no-undefer)) + nil nil nil 'with-affiliated 'no-undefer) + (org-element--cache-log-message + "Recovering persistent cached element: %S" + (org-element--format-element el))) org-element--cache) (setq-local org-element--cache-size (avl-tree-size org-element--cache))) (when (and (equal container '(elisp org-element--headline-cache)) org-element--headline-cache)