emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nathan Neff <nathan.neff@gmail.com>
To: Carsten Dominik <dominik@uva.nl>
Cc: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: Insert subheading at top respect content
Date: Tue, 20 Aug 2019 17:42:51 -0500	[thread overview]
Message-ID: <CAC=HedCmyWmAza9rsSLgUXXtH_q7g96mGxHghjJ5MbaGinQejQ@mail.gmail.com> (raw)
In-Reply-To: <CADn3Z2L8yhhsPDnB=MpffLmxcNtGgv_qDnN6gJ4xOHaC6dODoQ@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1442 bytes --]

On Fri, Aug 16, 2019 at 4:03 AM Carsten Dominik <dominik@uva.nl> wrote:

>
>
> On Fri, Aug 16, 2019 at 10:21 AM Nathan Neff <nathan.neff@gmail.com>
> 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
>>
>

[-- Attachment #2: Type: text/html, Size: 3154 bytes --]

  reply	other threads:[~2019-08-20 22:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-16  8:12 Insert subheading at top respect content Nathan Neff
2019-08-16  9:03 ` Carsten Dominik
2019-08-20 22:42   ` Nathan Neff [this message]
2019-08-21  1:43     ` Nathan Neff
2019-08-21  5:28     ` Carsten Dominik
2019-08-22 19:13       ` Nathan Neff
2019-08-22 21:07         ` Carsten Dominik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAC=HedCmyWmAza9rsSLgUXXtH_q7g96mGxHghjJ5MbaGinQejQ@mail.gmail.com' \
    --to=nathan.neff@gmail.com \
    --cc=dominik@uva.nl \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).