diff --git a/lisp/org-element.el b/lisp/org-element.el index c08ccb116..3cf87b290 100644 --- a/lisp/org-element.el +++ b/lisp/org-element.el @@ -1178,8 +1178,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 5cfe95afe..f384aaaa7 100644 --- a/testing/lisp/test-org-element.el +++ b/testing/lisp/test-org-element.el @@ -1503,15 +1503,19 @@ e^{i\\pi}+1=0 - inner Outside list" - (let ((endings (org-element-map - (org-element-parse-buffer) 'plain-list - (lambda (pl) (org-element-property :end pl))))) + (let ((endings (org-element-map (org-element-parse-buffer) 'plain-list + (lambda (pl) (org-element-property :end pl))))) ;; Move to ending of outer list. (goto-char (car endings)) (should (looking-at "Outside list")) ;; Move to ending of inner list. (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