branch: externals/org
commit 93821b431ce5255a2865de178df2d722d3de3040
Author: Ihor Radchenko <yanta...@gmail.com>
Commit: Ihor Radchenko <yanta...@gmail.com>

    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.
---
 lisp/org-element.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/org-element.el b/lisp/org-element.el
index 065b2a99ad..cbd0dd3d57 100644
--- a/lisp/org-element.el
+++ b/lisp/org-element.el
@@ -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"

Reply via email to