org-element--cache-active-p: Fix when cache is disabled in indirect buffers

* lisp/org-element.el (org-element--cache-active-p): Consider cache
disabled when any of the indirect buffers do not have modification
detection.  This can be important when one uses
`combine-after-change-calls' inside an indirect buffers disabling
`after-change-functions' temporarily in the indirect buffer.

Reported-by: Feng Shu <tumashu@163.com>
Link: https://orgmode.org/list/87359z8ssb.fsf@163.com
This commit is contained in:
Ihor Radchenko 2022-12-04 16:02:17 +03:00
parent 461eb2a0ec
commit 7e6b55b8fd
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
1 changed files with 5 additions and 1 deletions

View File

@ -5717,7 +5717,11 @@ This function assumes `org-element--headline-cache' is a valid AVL tree."
;; `combine-change-calls' because the buffer is potentially
;; changed without notice (the change will be registered
;; after exiting the `combine-change-calls' body though).
(memq #'org-element--cache-after-change after-change-functions))))))
(catch :inhibited
(org-fold-core-cycle-over-indirect-buffers
(unless (memq #'org-element--cache-after-change after-change-functions)
(throw :inhibited nil)))
t))))))
;; FIXME: Remove after we establish that hashing is effective.
(defun org-element-cache-hash-show-statistics ()