Fix indentation bug
* lisp/org.el (org--get-expected-indentation): Return correct columns when at the end of an empty item. * testing/lisp/test-org.el (test-org/indent-line): Add test.
This commit is contained in:
parent
a94147535a
commit
954103dd9b
|
@ -23004,12 +23004,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.
|
||||
|
|
|
@ -644,6 +644,11 @@
|
|||
(goto-char (point-max))
|
||||
(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"
|
||||
|
|
Loading…
Reference in New Issue