From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nathan Neff Subject: Re: Insert subheading at top respect content Date: Tue, 20 Aug 2019 20:43:53 -0500 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="0000000000005983a5059096b5ec" Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:60744) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i0FfT-0004sP-WF for emacs-orgmode@gnu.org; Tue, 20 Aug 2019 21:44:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i0FfS-0001b7-TQ for emacs-orgmode@gnu.org; Tue, 20 Aug 2019 21:44:07 -0400 Received: from mail-io1-xd2f.google.com ([2607:f8b0:4864:20::d2f]:34189) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i0FfS-0001aj-IN for emacs-orgmode@gnu.org; Tue, 20 Aug 2019 21:44:06 -0400 Received: by mail-io1-xd2f.google.com with SMTP id s21so1431288ioa.1 for ; Tue, 20 Aug 2019 18:44:06 -0700 (PDT) In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Carsten Dominik Cc: emacs-orgmode --0000000000005983a5059096b5ec Content-Type: text/plain; charset="UTF-8" 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 >>> >> --0000000000005983a5059096b5ec Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
On Tue, Aug 20, 2019 at 5:42 PM Natha= n Neff <nathan.neff@gmail.com> wrote:


<= br>
On Fri,= Aug 16, 2019 at 10:21 AM Nathan Neff <nathan.neff@gmail.com> wrote:
Hello all,

Som= ething that's eluded me all this time has been an
"Inser= t subheading, after the content, but before other subheadings"

For example:
If my cursor is anywhere between l= ines 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 abo= ve.=C2=A0 I would
like to have a new subheading at line 4.

What about C-c C-n M-RET

Thanks Carsten - I created a func= tion:
(defun njn-subheading-respect-content ()
=C2=A0 (= interactive "")
=C2=A0 (org-next-visible-heading 1)
=C2=A0 (org-insert-subheading 't)
=C2=A0)
But I'm trying to find out where to get the "correct&= quot; 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
=C2=A0
I will mess with this function a b= it and post if I find a solution.

Thanks,
--Nate
=

Carsten
=C2=A0

Thanks,
--Nate
<= /div>
--0000000000005983a5059096b5ec--