org-element-cache: Fix indirect buffer tracking
* lisp/org-element.el (org-element--cache-setup-change-functions): Make sure that indirect buffers are registered to be traversed in `org-fold-core-cycle-over-indirect-buffers' in `org-element--cache-active-p'. `org-fold-core-decouple-indirect-buffer-folds' may not be called in some scenarios when Org mode is active. The reproducer that revealed the problem is in https://orgmode.org/list/CAD6d+LUJ7St5_muvwqzE80EfHSoiMmZD+qDTAojeN0L7v+zsCQ@mail.gmail.com
This commit is contained in:
parent
de0df5b925
commit
ac1d58477a
|
@ -7247,6 +7247,11 @@ that range. See `after-change-functions' for more information."
|
|||
(when (buffer-base-buffer)
|
||||
(setq-local org-element--cache nil)
|
||||
(setq-local org-element--headline-cache nil))
|
||||
;; Register current buffer in `org-fold-core--indirect-buffers' to
|
||||
;; be used within `org-fold-core-cycle-over-indirect-buffers'.
|
||||
;; FIXME: We should eventually factor out indirect buffer tracking
|
||||
;; from org-fold-core.
|
||||
(org-fold-core-decouple-indirect-buffer-folds)
|
||||
(add-hook 'before-change-functions
|
||||
#'org-element--cache-before-change nil t)
|
||||
;; Run `org-element--cache-after-change' early to handle cases
|
||||
|
|
Loading…
Reference in New Issue