fix: Infinite loop for last element in file

org-element-and-children-at-point was comparing the current point <=
end, but should've been <.

Fixes #17
This commit is contained in:
Griffin Smith 2019-05-20 10:49:24 -04:00
parent 603f614c35
commit 9d83cb22a1

View file

@ -257,13 +257,14 @@ If set to nil, will never create stories with labels")
(defun org-element-and-children-at-point ()
(let* ((elt (org-element-find-headline))
(contents-begin (plist-get elt :contents-begin))
(contents-begin (or (plist-get elt :contents-begin)
(plist-get elt :begin)))
(end (plist-get elt :end))
(level (plist-get elt :level))
(children '()))
(save-excursion
(goto-char (+ contents-begin (length (plist-get elt :title))))
(while (<= (point) end)
(while (< (point) end)
(let* ((next-elt (org-element-at-point))
(elt-type (car next-elt))
(elt (cadr next-elt)))