org-element--cache-for-removal: Improve performance

* lisp/org-element.el (org-element--cache-for-removal): Directly check
for headline at point instead of running full
`org-element--current-element' that is matching a large number of
regexps.
This commit is contained in:
Ihor Radchenko 2022-06-08 18:18:36 +08:00
parent 46df681336
commit 93821b431c
No known key found for this signature in database
GPG key ID: 6470762A7DA11D8B

View file

@ -6909,7 +6909,8 @@ known element in cache (it may start after END)."
(not (> end (org-element-property :end up)))
(let ((current (org-with-point-at (org-element-property :begin up)
(org-element-with-disabled-cache
(org-element--current-element (point-max))))))
(and (looking-at-p org-element-headline-re)
(org-element-headline-parser nil t))))))
(when (eq 'headline (org-element-type current))
(org-element--cache-log-message
"Found non-robust headline that can be updated individually: %S"