From 7e6b55b8fdd9a3908dfafb23531762ae4c0ae1d5 Mon Sep 17 00:00:00 2001 From: Ihor Radchenko Date: Sun, 4 Dec 2022 16:02:17 +0300 Subject: [PATCH] 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 Link: https://orgmode.org/list/87359z8ssb.fsf@163.com --- lisp/org-element.el | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lisp/org-element.el b/lisp/org-element.el index 48ede9c52..1f36775a7 100644 --- a/lisp/org-element.el +++ b/lisp/org-element.el @@ -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 ()