Bladeren bron

Fix `org-return' on list items

* lisp/org.el (org-return): Properly preserve list structure when
  calling `org-return-indent' on an item.

* testing/lisp/test-org.el (test-org/return): Add test.

Reported-by: Rasmus <rasmus@gmx.us>
<http://permalink.gmane.org/gmane.emacs.orgmode/94977>
Nicolas Goaziou 10 jaren geleden
bovenliggende
commit
55ce4b74b3
2 gewijzigde bestanden met toevoegingen van 6 en 1 verwijderingen
  1. 1 1
      lisp/org.el
  2. 5 0
      testing/lisp/test-org.el

+ 1 - 1
lisp/org.el

@@ -20993,7 +20993,7 @@ object (e.g., within a comment).  In these case, you need to use
        ;; In a list, make sure indenting keeps trailing text within.
        ((and indent
 	     (not (eolp))
-	     (org-element-lineage context '(item plain-list) t))
+	     (org-element-lineage context '(item)))
 	(let ((trailing-data
 	       (delete-and-extract-region (point) (line-end-position))))
 	  (newline-and-indent)

+ 5 - 0
testing/lisp/test-org.el

@@ -861,6 +861,11 @@
 	  (org-test-with-temp-text "- A <point>B"
 	    (org-return t)
 	    (buffer-string))))
+  (should
+   (equal "- A\n\n- B"
+	  (org-test-with-temp-text "- A\n<point>- B"
+	    (org-return t)
+	    (buffer-string))))
   ;; Special case: on tags part of a headline, add a newline below it
   ;; instead of breaking it.
   (should