Fix indentation bug

* lisp/org.el (org--get-expected-indentation): Fix indentation.
* testing/lisp/test-org.el (test-org/indent-line): Add test.
This commit is contained in:
Nicolas Goaziou 2016-03-17 16:50:54 +01:00
parent 9879c20a34
commit 261eadb9d4
2 changed files with 6 additions and 5 deletions

View File

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

View File

@ -656,6 +656,11 @@
(goto-char (point-max)) (goto-char (point-max))
(let ((org-adapt-indentation t)) (org-indent-line)) (let ((org-adapt-indentation t)) (org-indent-line))
(org-get-indentation)))) (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, ;; Likewise, on a blank line at the end of a footnote definition,
;; indent at column 0 if line belongs to the definition. Otherwise, ;; indent at column 0 if line belongs to the definition. Otherwise,
;; indent like the definition itself. ;; indent like the definition itself.