Browse Source

Merge branch 'maint'

Nicolas Goaziou 9 years ago
parent
commit
ff236e5c85
2 changed files with 10 additions and 2 deletions
  1. 5 2
      lisp/org.el
  2. 5 0
      testing/lisp/test-org.el

+ 5 - 2
lisp/org.el

@@ -22875,12 +22875,15 @@ ELEMENT."
 	  ;;
 	  ;; As a special case, if point is at the end of a footnote
 	  ;; definition or an item, indent like the very last element
-	  ;; within.
+	  ;; within.  If that last element is an item, indent like its
+	  ;; contents.
 	  ((and (not (eq type 'paragraph))
 		(let ((cend (org-element-property :contents-end element)))
 		  (and cend (<= cend pos))))
 	   (if (memq type '(footnote-definition item plain-list))
-	       (org--get-expected-indentation (org-element-at-point) nil)
+	       (let ((last (org-element-at-point)))
+		 (org--get-expected-indentation
+		  last (eq (org-element-type last) 'item)))
 	     (goto-char start)
 	     (org-get-indentation)))
 	  ;; In any other case, indent like the current line.

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

@@ -721,6 +721,11 @@
       (org-test-with-temp-text "* H\n- A\n  - AA\n<point>"
 	(let ((org-adapt-indentation t)) (org-indent-line))
 	(org-get-indentation))))
+  (should
+   (= 4
+      (org-test-with-temp-text "* H\n- A\n  -\n\n<point>"
+	(let ((org-adapt-indentation t)) (org-indent-line))
+	(org-get-indentation))))
   (should
    (zerop
     (org-test-with-temp-text "* H\n- A\n  - AA\n\n\n\n<point>"