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
|
;; parsing from NEXT, which is located after CACHED or its
|
||||||
;; higher ancestor not containing point.
|
;; higher ancestor not containing point.
|
||||||
(t
|
(t
|
||||||
(let ((up cached))
|
(let ((up cached)
|
||||||
|
(origin (if (= (point-max) origin) (1- origin) origin)))
|
||||||
(goto-char (or (org-element-property :contents-begin cached)
|
(goto-char (or (org-element-property :contents-begin cached)
|
||||||
begin))
|
begin))
|
||||||
(while (and up
|
(while (let ((end (org-element-property :end up)))
|
||||||
(not (eobp))
|
(and (<= end origin)
|
||||||
(<= (org-element-property :end up) origin))
|
(goto-char end)
|
||||||
(goto-char (org-element-property :end up))
|
(setq up (org-element-property :parent up)))))
|
||||||
(setq up (org-element-property :parent up)))
|
|
||||||
(cond ((not up))
|
(cond ((not up))
|
||||||
((eobp) (setq element up))
|
((eobp) (setq element up))
|
||||||
(t (setq element up next (point))))))))
|
(t (setq element up next (point))))))))
|
||||||
|
|
Loading…
Reference in New Issue