org-element-cache: Optimise changed property drawer detection

* lisp/org-element.el (org-element--cache-for-removal): Only force
re-parsing headlines when the changed region falls within the headline
before property drawer end position.
This commit is contained in:
Ihor Radchenko 2021-12-16 11:18:00 +08:00
parent 23d8d59df8
commit cfe4b17d96
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
1 changed files with 4 additions and 2 deletions

View File

@ -6674,9 +6674,11 @@ known element in cache (it may start after END)."
(goto-char (point-min))
(while (and (org-at-comment-p) (bolp)) (forward-line))
;; Should not see property
;; drawer inside robust
;; drawer within changed
;; region.
(not (looking-at org-property-drawer-re)))))
(save-match-data
(or (not (looking-at org-property-drawer-re))
(> beg (match-end 0)))))))
(_ 'robust)))))
;; UP is a robust greater element containing changes.
;; We only need to extend its ending boundaries.