lisp/org.el: Fix indentation when `org-adapt-indentation' is 'headline-data
* lisp/org.el (org--get-expected-indentation): Fix indentation of non-headllines with `org-adapt-indentation' set to 'headline-data. (org-indent-line): When `org-adapt-indentation' is 'headline-data, don't indent when point is at the first line after a headline. Update the docstring to make it explicit that indenting relatively to current level only happens when `org-adapt-indentation' is set to `t'.
This commit is contained in:
parent
4c76962814
commit
c7331f859d
10
lisp/org.el
10
lisp/org.el
|
@ -18895,7 +18895,7 @@ ELEMENT."
|
||||||
(org--get-expected-indentation
|
(org--get-expected-indentation
|
||||||
(org-element-property :parent previous) t))))))))))
|
(org-element-property :parent previous) t))))))))))
|
||||||
;; Otherwise, move to the first non-blank line above.
|
;; Otherwise, move to the first non-blank line above.
|
||||||
((not (eq org-adapt-indentation 'headline-data))
|
(t
|
||||||
(beginning-of-line)
|
(beginning-of-line)
|
||||||
(let ((pos (point)))
|
(let ((pos (point)))
|
||||||
(skip-chars-backward " \r\t\n")
|
(skip-chars-backward " \r\t\n")
|
||||||
|
@ -18972,7 +18972,7 @@ Indentation is done according to the following rules:
|
||||||
Else, indent like parent's first line.
|
Else, indent like parent's first line.
|
||||||
|
|
||||||
3. Otherwise, indent relatively to current level, if
|
3. Otherwise, indent relatively to current level, if
|
||||||
`org-adapt-indentation' is non-nil, or to left margin.
|
`org-adapt-indentation' is `t', or to left margin.
|
||||||
|
|
||||||
- On a blank line at the end of an element, indent according to
|
- On a blank line at the end of an element, indent according to
|
||||||
the type of the element. More precisely
|
the type of the element. More precisely
|
||||||
|
@ -18997,7 +18997,11 @@ list structure. Instead, use \\<org-mode-map>`\\[org-shiftmetaleft]' or \
|
||||||
|
|
||||||
Also align node properties according to `org-property-format'."
|
Also align node properties according to `org-property-format'."
|
||||||
(interactive)
|
(interactive)
|
||||||
(unless (org-at-heading-p)
|
(unless (or (org-at-heading-p)
|
||||||
|
(and (eq org-adapt-indentation 'headline-data)
|
||||||
|
(save-excursion
|
||||||
|
(move-beginning-of-line 0)
|
||||||
|
(org-at-heading-p))))
|
||||||
(let* ((element (save-excursion (beginning-of-line) (org-element-at-point)))
|
(let* ((element (save-excursion (beginning-of-line) (org-element-at-point)))
|
||||||
(type (org-element-type element)))
|
(type (org-element-type element)))
|
||||||
(cond ((and (memq type '(plain-list item))
|
(cond ((and (memq type '(plain-list item))
|
||||||
|
|
Loading…
Reference in New Issue