On Tue, Aug 20, 2019 at 5:42 PM Nathan Neff wrote: > > > On Fri, Aug 16, 2019 at 4:03 AM Carsten Dominik wrote: > >> >> >> On Fri, Aug 16, 2019 at 10:21 AM Nathan Neff >> wrote: >> >>> Hello all, >>> >>> Something that's eluded me all this time has been an >>> "Insert subheading, after the content, but before other subheadings" >>> >>> For example: >>> If my cursor is anywhere between lines 1 and 4, I would like the >>> subheading >>> to be inserted at line 5. >>> >>> 1* Heading >>> :PROPERTIES:... >>> 2 Some content >>> 3 More content >>> 4 >>> 5** Subheading 1 >>> 6** Subheading 2 >>> 7 >>> I know there's org-insert-subheading and C-u which respects content, but >>> respect-content will insert a subheading at line 7 in the example >>> above. I would >>> like to have a new subheading at line 4. >>> >> >> What about C-c C-n M-RET >> > > Thanks Carsten - I created a function: > (defun njn-subheading-respect-content () > (interactive "") > (org-next-visible-heading 1) > (org-insert-subheading 't) > ) > > But I'm trying to find out where to get the "correct" arg > to org-next-visible-heading - I have hard-coded a 1 in the > above example, but this produces the following subheading: > > * Heading <-exec when cursor on this heading > Some content about Heading > *** New heading is inserted here (and is the wrong level - should be 2 > instead of 3) > ** Sub1 > ** Sub2 > > I will mess with this function a bit and post if I find a solution. > > Thanks, > --Nate > >> >> Carsten >> >> >>> >>> Thanks, >>> --Nate >>> >>