emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/org cbfe1354b3 3/3: org-insert-subheading: Never insert


From: ELPA Syncer
Subject: [elpa] externals/org cbfe1354b3 3/3: org-insert-subheading: Never insert sub-heading above current
Date: Sat, 10 Feb 2024 12:58:33 -0500 (EST)

branch: externals/org
commit cbfe1354b37f267f2e2526c28710f05a95fcac23
Author: Ihor Radchenko <yantar92@posteo.net>
Commit: Ihor Radchenko <yantar92@posteo.net>

    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/
---
 etc/ORG-NEWS | 21 +++++++++++++++++++++
 lisp/org.el  |  6 +++++-
 2 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 1d69d9b997..8e15d91b26 100644
--- a/etc/ORG-NEWS
+++ b/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
diff --git a/lisp/org.el b/lisp/org.el
index d09699388c..911194797b 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -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))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]