Browse Source

org-element--parse-to: Fix return value at the and of first section

* lisp/org-element.el (org-element--parse-to): Fix edge case when
calling `org-element--parse-to' at contents end point of first
section.  We need to return outermost element ending before point in
such scenario.

Fixes https://list.orgmode.org/01bc6137-200d-8e2d-fdd7-6aad8382c619@posteo.eu/T/#u
Ihor Radchenko 3 years ago
parent
commit
ced2b33357
1 changed files with 1 additions and 1 deletions
  1. 1 1
      lisp/org-element.el

+ 1 - 1
lisp/org-element.el

@@ -6415,7 +6415,7 @@ If you observe Emacs hangs frequently, please report this to Org mode mailing li
                                   ;; the headline section.
 			          (and (org-element--open-end-p element)
                                        (or (= (org-element-property :end element) (point-max))
-                                           (and (> pos (org-element-property :contents-end element))
+                                           (and (>= pos (org-element-property :contents-end element))
                                                 (memq (org-element-type element) '(org-data section headline)))))))
 		     (goto-char (or next cbeg))
 		     (setq mode (if next mode (org-element--next-mode mode type t))