Skip to content

Commit aa5bc2c

Browse files
committed
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.
1 parent eb796ae commit aa5bc2c

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

lisp/org-element.el

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7166,16 +7166,15 @@ The element is: %S\n The real element is: %S\n Cache around :begin:\n%S\n%S\n%S"
71667166
(with-current-buffer (get-file-buffer (plist-get associated :file))
71677167
(if (and (derived-mode-p 'org-mode)
71687168
org-element--cache)
7169-
(progn
7170-
;; Cleanup cache request keys to avoid collisions during next
7171-
;; Emacs session.
7172-
(avl-tree-mapc
7173-
(lambda (el)
7174-
(org-element-put-property el :org-element--cache-sync-key nil))
7175-
org-element--cache)
7176-
(org-with-wide-buffer
7177-
(org-element-at-point (point-max)))
7178-
nil)
7169+
(org-with-wide-buffer
7170+
(org-element--cache-sync (current-buffer) (point-max))
7171+
;; Cleanup cache request keys to avoid collisions during next
7172+
;; Emacs session.
7173+
(avl-tree-mapc
7174+
(lambda (el)
7175+
(org-element-put-property el :org-element--cache-sync-key nil))
7176+
org-element--cache)
7177+
nil)
71797178
'forbid))
71807179
'forbid)))
71817180

0 commit comments

Comments
 (0)