org-insert-subheading: Never insert sub-heading above current
* lisp/org.el (org-insert-subheading): When at bol, do not insert heading above (default behavior of `org-insert-heading'). Instead, force `org-insert-heading' to insert below. Improve docstring, explaining how the prefix arguments are used and the new different with `org-insert-heading'. * etc/ORG-NEWS (~org-insert-subheading~ no longer inserts a sub-heading above current when point is at the beginning of line): Document the breaking change. Reported-by: Michael Dauer <mick.dauer@gmail.com> Link: https://list.orgmode.org/CAP7OBx+whiB8Jo_hEcfL6MajDU1EH=E5j0ZOvHB3dPRK+Aj4mQ@mail.gmail.com/
This commit is contained in:
parent
9ddfb66996
commit
cbfe1354b3
21
etc/ORG-NEWS
21
etc/ORG-NEWS
|
@ -13,6 +13,27 @@ Please send Org bug reports to mailto:emacs-orgmode@gnu.org.
|
|||
|
||||
* Version 9.7 (not released yet)
|
||||
** Important announcements and breaking changes
|
||||
*** ~org-insert-subheading~ no longer inserts a sub-heading above current when point is at the beginning of line
|
||||
|
||||
Previously, calling ~org-insert-subheading~ on
|
||||
|
||||
: * Heading 1
|
||||
: <point>* Heading 2
|
||||
|
||||
yielded
|
||||
|
||||
: * Heading 1
|
||||
: ** <point>
|
||||
: * Heading 2
|
||||
|
||||
This is no longer the case. The sub-heading is always created below
|
||||
current heading (prefix arguments have the same meaning as in
|
||||
~org-insert-heading~):
|
||||
|
||||
: * Heading 1
|
||||
: * Heading 2
|
||||
: ** <point>
|
||||
|
||||
*** Org mode now fontifies whole table lines (including newline) according to ~org-table~ face
|
||||
|
||||
Previously, leading indentation and trailing newline in table rows
|
||||
|
|
|
@ -6633,8 +6633,12 @@ unchecked check box."
|
|||
|
||||
(defun org-insert-subheading (arg)
|
||||
"Insert a new subheading and demote it.
|
||||
Works for outline headings and for plain lists alike."
|
||||
Works for outline headings and for plain lists alike.
|
||||
The prefix argument ARG is passed to `org-insert-heading'.
|
||||
Unlike `org-insert-heading', when point is at the beginning of a
|
||||
heading, still insert the new sub-heading below."
|
||||
(interactive "P")
|
||||
(when (bolp) (forward-char))
|
||||
(org-insert-heading arg)
|
||||
(cond
|
||||
((org-at-heading-p) (org-do-demote))
|
||||
|
|
Loading…
Reference in New Issue