|
@@ -6583,6 +6583,19 @@ that range. See `after-change-functions' for more information."
|
|
|
;; Activate a timer to process the request during idle time.
|
|
|
(org-element--cache-set-timer (current-buffer))))))
|
|
|
|
|
|
+(defvar org-element--cache-avoid-synchronous-headline-re-parsing nil
|
|
|
+ "This variable controls how buffer changes are handled by the cache.
|
|
|
+
|
|
|
+By default (when this variable is nil), cache re-parses modified
|
|
|
+headlines immidiately after modification preserving all the unaffected
|
|
|
+elements inside the headline.
|
|
|
+
|
|
|
+The default behaviour works best when users types inside Org buffer of
|
|
|
+when buffer modifications are mixed with cache requests. However,
|
|
|
+large automated edits inserting/deleting many headlines are somewhat
|
|
|
+slower by default (as in `org-archive-subtree'). Let-binding this
|
|
|
+variable to non-nil will reduce cache latency after every singular edit
|
|
|
+(`after-change-functions') at the cost of slower cache queries.")
|
|
|
(defun org-element--cache-for-removal (beg end offset)
|
|
|
"Return first element to remove from cache.
|
|
|
|
|
@@ -6674,6 +6687,7 @@ known element in cache (it may start after END)."
|
|
|
;; its boundaries could have extended to shrinked - we
|
|
|
;; will re-parent and shift them anyway.
|
|
|
(and (eq 'headline (org-element-type up))
|
|
|
+ (not org-element--cache-avoid-synchronous-headline-re-parsing)
|
|
|
;; The change is not inside headline. Not
|
|
|
;; updating here.
|
|
|
(not (<= beg (org-element-property :begin up)))
|