forked from mirrors/org-mode
org-element: Fix infloop when parsing a list at the end of buffer
* lisp/org-element.el (org-element-plain-list-parser): Fix infloop when parsing a list at the end of buffer, if buffer doesn't end at a line beginning. * testing/lisp/test-org-element.el: Add test.
This commit is contained in:
parent
21dd83661b
commit
b4a8ec9321
|
@ -1178,8 +1178,7 @@ Assume point is at the beginning of the list."
|
||||||
(unless (bolp) (forward-line))
|
(unless (bolp) (forward-line))
|
||||||
(point)))
|
(point)))
|
||||||
(end (progn (skip-chars-forward " \r\t\n" limit)
|
(end (progn (skip-chars-forward " \r\t\n" limit)
|
||||||
(skip-chars-backward " \t")
|
(if (= (point) limit) limit (line-beginning-position)))))
|
||||||
(if (bolp) (point) (line-end-position)))))
|
|
||||||
;; Return value.
|
;; Return value.
|
||||||
(list 'plain-list
|
(list 'plain-list
|
||||||
(nconc
|
(nconc
|
||||||
|
|
|
@ -1503,15 +1503,19 @@ e^{i\\pi}+1=0
|
||||||
- inner
|
- inner
|
||||||
|
|
||||||
Outside list"
|
Outside list"
|
||||||
(let ((endings (org-element-map
|
(let ((endings (org-element-map (org-element-parse-buffer) 'plain-list
|
||||||
(org-element-parse-buffer) 'plain-list
|
(lambda (pl) (org-element-property :end pl)))))
|
||||||
(lambda (pl) (org-element-property :end pl)))))
|
|
||||||
;; Move to ending of outer list.
|
;; Move to ending of outer list.
|
||||||
(goto-char (car endings))
|
(goto-char (car endings))
|
||||||
(should (looking-at "Outside list"))
|
(should (looking-at "Outside list"))
|
||||||
;; Move to ending of inner list.
|
;; Move to ending of inner list.
|
||||||
(goto-char (nth 1 endings))
|
(goto-char (nth 1 endings))
|
||||||
(should (looking-at "^$")))))
|
(should (looking-at "^$"))))
|
||||||
|
;; Correctly compute end of list if it doesn't end at a line
|
||||||
|
;; beginning.
|
||||||
|
(should
|
||||||
|
(org-test-with-temp-text "- list\n \n "
|
||||||
|
(= (org-element-property :end (org-element-at-point)) (point-max)))))
|
||||||
|
|
||||||
|
|
||||||
;;;; Planning
|
;;;; Planning
|
||||||
|
|
Loading…
Reference in a new issue