org-element: Fix `org-element-at-point' at eob
* lisp/org-element.el (org-element-at-point): Return appropriate value when point is at end of buffer and a cached element was found above.
This commit is contained in:
parent
e0f46e9a1d
commit
f75f3dd1c1
|
@ -4789,14 +4789,14 @@ element ending there."
|
|||
;; parsing from NEXT, which is located after CACHED or its
|
||||
;; higher ancestor not containing point.
|
||||
(t
|
||||
(let ((up cached))
|
||||
(let ((up cached)
|
||||
(origin (if (= (point-max) origin) (1- origin) origin)))
|
||||
(goto-char (or (org-element-property :contents-begin cached)
|
||||
begin))
|
||||
(while (and up
|
||||
(not (eobp))
|
||||
(<= (org-element-property :end up) origin))
|
||||
(goto-char (org-element-property :end up))
|
||||
(setq up (org-element-property :parent up)))
|
||||
(while (let ((end (org-element-property :end up)))
|
||||
(and (<= end origin)
|
||||
(goto-char end)
|
||||
(setq up (org-element-property :parent up)))))
|
||||
(cond ((not up))
|
||||
((eobp) (setq element up))
|
||||
(t (setq element up next (point))))))))
|
||||
|
|
Loading…
Reference in New Issue