From fd877a73809e290a8425b3dced94ae4d5b425cd2 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Sun, 19 Jan 2014 15:06:09 +0100 Subject: [PATCH] org-element: Small optimization * lisp/org-element.el (org-element-at-point): Do not call `outline-next-heading' when an element at top level contains point. This is particularly important when the current section ends way after the point. --- lisp/org-element.el | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lisp/org-element.el b/lisp/org-element.el index 4932a5c62..fc835e515 100644 --- a/lisp/org-element.el +++ b/lisp/org-element.el @@ -4800,8 +4800,7 @@ element ending there." ((eobp) (setq element up)) (t (setq element up next (point)))))))) ;; Parse successively each element until we reach ORIGIN. - (let ((end (or (org-element-property - :contents-end (org-element-property :parent element)) + (let ((end (or (org-element-property :end element) (save-excursion (org-with-limited-levels (outline-next-heading)) (point))))