branch: externals/org commit aa5bc2c760d142ae24eb9253ff472d5505c612de Author: Ihor Radchenko <yanta...@gmail.com> Commit: Ihor Radchenko <yanta...@gmail.com>
org-element-cache: Make sure that cache is correctly synced before saving * lisp/org-element.el (org-element--cache-persist-before-write): Sync cache before force-overwriting transient cache keys. --- lisp/org-element.el | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/lisp/org-element.el b/lisp/org-element.el index 7d2168496b..2a826bdbb3 100644 --- a/lisp/org-element.el +++ b/lisp/org-element.el @@ -7166,16 +7166,15 @@ The element is: %S\n The real element is: %S\n Cache around :begin:\n%S\n%S\n%S" (with-current-buffer (get-file-buffer (plist-get associated :file)) (if (and (derived-mode-p 'org-mode) org-element--cache) - (progn - ;; Cleanup cache request keys to avoid collisions during next - ;; Emacs session. - (avl-tree-mapc - (lambda (el) - (org-element-put-property el :org-element--cache-sync-key nil)) - org-element--cache) - (org-with-wide-buffer - (org-element-at-point (point-max))) - nil) + (org-with-wide-buffer + (org-element--cache-sync (current-buffer) (point-max)) + ;; Cleanup cache request keys to avoid collisions during next + ;; Emacs session. + (avl-tree-mapc + (lambda (el) + (org-element-put-property el :org-element--cache-sync-key nil)) + org-element--cache) + nil) 'forbid)) 'forbid)))