diff --git a/lisp/org-element.el b/lisp/org-element.el index afbaf1484..0a3f5f602 100644 --- a/lisp/org-element.el +++ b/lisp/org-element.el @@ -1261,8 +1261,7 @@ Assume point is at the beginning of the list." (unless (bolp) (forward-line)) (point))) (end (progn (skip-chars-forward " \r\t\n" limit) - (skip-chars-backward " \t") - (if (bolp) (point) (line-end-position))))) + (if (= (point) limit) limit (line-beginning-position))))) ;; Return value. (list 'plain-list (nconc diff --git a/testing/lisp/test-org-element.el b/testing/lisp/test-org-element.el index e521fad27..2129cdede 100644 --- a/testing/lisp/test-org-element.el +++ b/testing/lisp/test-org-element.el @@ -1511,7 +1511,12 @@ Outside list" ;; Move to ending of outer list. (progn (goto-char (car endings)) (looking-at "Outside list")) ;; Move to ending of inner list. - (progn (goto-char (nth 1 endings)) (looking-at "^$")))))))) + (progn (goto-char (nth 1 endings)) (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