[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org 9f87b1c: org-element.el: Handle cache requests insi
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org 9f87b1c: org-element.el: Handle cache requests inside `combine-change-calls' |
Date: |
Fri, 29 Oct 2021 10:57:26 -0400 (EDT) |
branch: externals/org
commit 9f87b1cc33962510d5169213c0ac7c40d5916631
Author: Ihor Radchenko <yantar92@gmail.com>
Commit: Ihor Radchenko <yantar92@gmail.com>
org-element.el: Handle cache requests inside `combine-change-calls'
* lisp/org-element.el (org-element--cache-active-p): Prevent cache
queries when `org-element--cache-after-change' is not in
`after-change-functions'. `after-change-functions' can be temporalily
set to nil by i.e. `combine-change-calls'. We should not try to get
information from cache in such scenarios because cache may not yet be
up-to-date. The modifications will only be registered upon exiting
the `combine-change-calls' macro.
Fixes https://list.orgmode.org/875ytggcuk.fsf@yandex.com/T/#t
---
lisp/org-element.el | 23 +++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)
diff --git a/lisp/org-element.el b/lisp/org-element.el
index 64aa263..da08a56 100644
--- a/lisp/org-element.el
+++ b/lisp/org-element.el
@@ -5600,15 +5600,22 @@ This function assumes `org-element--headline-cache' is
a valid AVL tree."
(and org-element-use-cache
org-element--cache
(derived-mode-p 'org-mode)
- ;; org-num-mode calls some Org structure analysis functions
- ;; that can trigger cache update in the middle of changes. See
- ;; `org-num--verify' calling `org-num--skip-value' calling
- ;; `org-entry-get' that uses cache.
- ;; Forcefully disable cache when called from inside a
- ;; modification hook, where `inhibit-modification-hooks' is set
- ;; to t.
(or called-from-cache-change-func-p
- (not inhibit-modification-hooks)
+ (and
+ ;; org-num-mode calls some Org structure analysis functions
+ ;; that can trigger cache update in the middle of changes. See
+ ;; `org-num--verify' calling `org-num--skip-value' calling
+ ;; `org-entry-get' that uses cache.
+ ;; Forcefully disable cache when called from inside a
+ ;; modification hook, where `inhibit-modification-hooks' is set
+ ;; to t.
+ (not inhibit-modification-hooks)
+ ;; `combine-change-calls' sets `after-change-functions' to
+ ;; nil. We need not to use cache inside
+ ;; `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))
(eq org-element--cache-change-tic (buffer-chars-modified-tick)))))
(defun org-element--cache-find (pos &optional side)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] externals/org 9f87b1c: org-element.el: Handle cache requests inside `combine-change-calls',
ELPA Syncer <=