Browse Source

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.
Ihor Radchenko 3 years ago
parent
commit
cfe4b17d96
1 changed files with 4 additions and 2 deletions
  1. 4 2
      lisp/org-element.el

+ 4 - 2
lisp/org-element.el

@@ -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.