Browse Source

Fix indentation bug

* lisp/org.el (org--get-expected-indentation): Fix indentation.
* testing/lisp/test-org.el (test-org/indent-line): Add test.
Nicolas Goaziou 9 years ago
parent
commit
261eadb9d4
2 changed files with 6 additions and 5 deletions
  1. 1 5
      lisp/org.el
  2. 5 0
      testing/lisp/test-org.el

+ 1 - 5
lisp/org.el

@@ -23009,11 +23009,7 @@ ELEMENT."
 		(let ((cend (org-element-property :contents-end element)))
 		  (and cend (<= cend pos))))
 	   (if (memq type '(footnote-definition item plain-list))
-	       (let ((last (org-element-at-point)))
-		 (org--get-expected-indentation
-		  last
-		  (memq (org-element-type last)
-			'(footnote-definition item plain-list))))
+	       (org--get-expected-indentation (org-element-at-point) nil)
 	     (goto-char start)
 	     (org-get-indentation)))
 	  ;; In any other case, indent like the current line.

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

@@ -656,6 +656,11 @@
 	(goto-char (point-max))
 	(let ((org-adapt-indentation t)) (org-indent-line))
 	(org-get-indentation))))
+  (should
+   (= 2
+      (org-test-with-temp-text "- A\n  B\n\n<point>"
+	(let ((org-adapt-indentation nil)) (org-indent-line))
+	(org-get-indentation))))
   ;; Likewise, on a blank line at the end of a footnote definition,
   ;; indent at column 0 if line belongs to the definition.  Otherwise,
   ;; indent like the definition itself.