forked from mirrors/org-mode
org--get-expected-indentation: Consider section parent type
* lisp/org.el (org--get-expected-indentation): Consider new :parent structure when `org-element-at-point' returns parent section and headline elements. * testing/lisp/test-org.el (test-org/indent-region): Add test. Fixes https://list.orgmode.org/87pmrupu0s.fsf@gmail.com/T/#t
This commit is contained in:
parent
e2fa3c4c40
commit
5f4fd0880a
|
@ -19218,6 +19218,10 @@ ELEMENT."
|
||||||
(contentsp
|
(contentsp
|
||||||
(cl-case type
|
(cl-case type
|
||||||
((diary-sexp footnote-definition) 0)
|
((diary-sexp footnote-definition) 0)
|
||||||
|
(section
|
||||||
|
(org--get-expected-indentation
|
||||||
|
(org-element-property :parent element)
|
||||||
|
t))
|
||||||
((headline inlinetask nil)
|
((headline inlinetask nil)
|
||||||
(if (not org-adapt-indentation) 0
|
(if (not org-adapt-indentation) 0
|
||||||
(let ((level (org-current-level)))
|
(let ((level (org-current-level)))
|
||||||
|
|
|
@ -1168,6 +1168,13 @@
|
||||||
(org-adapt-indentation nil))
|
(org-adapt-indentation nil))
|
||||||
(org-indent-region (point) (point-max)))
|
(org-indent-region (point) (point-max)))
|
||||||
(buffer-string))))
|
(buffer-string))))
|
||||||
|
;; Indent property drawers according to `org-adapt-indentation'.
|
||||||
|
(let ((org-adapt-indentation 'headline-data))
|
||||||
|
(should
|
||||||
|
(equal "* H\n :PROPERTIES:\n :key:\n :END:"
|
||||||
|
(org-test-with-temp-text "* H\n:PROPERTIES:\n:key:\n:END:"
|
||||||
|
(org-indent-region (point-min) (point-max))
|
||||||
|
(buffer-string)))))
|
||||||
;; Indent plain lists.
|
;; Indent plain lists.
|
||||||
(let ((org-adapt-indentation t))
|
(let ((org-adapt-indentation t))
|
||||||
(should
|
(should
|
||||||
|
|
Loading…
Reference in New Issue