Fix indentation bug
* lisp/org.el (org--get-expected-indentation): Fix indentation bug. * testing/lisp/test-org.el (test-org/indent-line): Add test. In the following document, the last line would be indented to "|" - item #+BEGIN_SRC emacs-lisp (+ 1 1) #+END_SRC |
This commit is contained in:
parent
1f84cc2182
commit
41d005822e
|
@ -22860,11 +22860,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) t)
|
||||
(goto-char start)
|
||||
(org-get-indentation)))
|
||||
;; In any other case, indent like the current line.
|
||||
|
|
|
@ -718,20 +718,23 @@
|
|||
;; whole list.
|
||||
(should
|
||||
(= 4
|
||||
(org-test-with-temp-text "* H\n- A\n - AA\n"
|
||||
(goto-char (point-max))
|
||||
(org-test-with-temp-text "* H\n- A\n - AA\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"
|
||||
(goto-char (point-max))
|
||||
(org-test-with-temp-text "* H\n- A\n - AA\n\n\n\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"
|
||||
(goto-char (point-max))
|
||||
(org-test-with-temp-text "* H\n- A\n - \n<point>"
|
||||
(let ((org-adapt-indentation t)) (org-indent-line))
|
||||
(org-get-indentation))))
|
||||
(should
|
||||
(= 4
|
||||
(org-test-with-temp-text
|
||||
"* H\n - \n #+BEGIN_SRC emacs-lisp\n t\n #+END_SRC\n<point>"
|
||||
(let ((org-adapt-indentation t)) (org-indent-line))
|
||||
(org-get-indentation))))
|
||||
;; Likewise, on a blank line at the end of a footnote definition,
|
||||
|
|
Loading…
Reference in New Issue