emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/org e90a8a69a7 5/5: org-element-cache: Log recovered pe


From: ELPA Syncer
Subject: [elpa] externals/org e90a8a69a7 5/5: org-element-cache: Log recovered persisted elements during loading
Date: Fri, 15 Sep 2023 06:58:33 -0400 (EDT)

branch: externals/org
commit e90a8a69a7fa2d83c995b5d32bc0b24a68218ed3
Author: Ihor Radchenko <yantar92@posteo.net>
Commit: Ihor Radchenko <yantar92@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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]