Skip to content

Commit

Permalink
org-element-cache: Make sure that cache is correctly synced before sa…
Browse files Browse the repository at this point in the history
…ving

* lisp/org-element.el (org-element--cache-persist-before-write): Sync
cache before force-overwriting transient cache keys.
  • Loading branch information
yantar92 committed Jun 29, 2022
1 parent eb796ae commit aa5bc2c
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions lisp/org-element.el
Original file line number Diff line number Diff line change
Expand Up @@ -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)))

Expand Down

0 comments on commit aa5bc2c

Please sign in to comment.