emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Marco Wahl <marcowahlsoft@gmail.com>
To: "Victor A. Stoichita" <victor@svictor.net>
Cc: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: behavior of (org-insert-heading-respect-content)
Date: Mon, 13 Sep 2021 21:21:48 +0200	[thread overview]
Message-ID: <875yv4uvqr.fsf@gmail.com> (raw)
In-Reply-To: <87ilz98s5a.fsf@svictor.net>

Hi Victor,

> Le 09 Sep 2021, Marco Wahl <marcowahlsoft@gmail.com> a écrit :
>> My impression is that org-insert-heading-respect-content should be
>> called only with point in a subtree.
>> The fix would be to signal an error when point is not located in a
>> subtree.
>> Does this sound reasonable?
> In a way, yes. I guess that the error would not appear too often.
> But falling back gracefully to org-insert-heading could be even
> better, especially when org-insert-heading-respect-content is called
> from Lisp (rather than interactively).
> For now, I use this and it seems to do the job:
> #+begin_src elisp
>   (if (equal 1 (line-number-at-pos nil t))
>         (org-insert-heading)
>       (org-insert-heading-respect-content))
> #+end_src
> If I’m not mistaken, org-insert-heading-respect-content works as
> expected even when point is not in a subtree. It seems to only fail if
> point is on the 1st line.

As far is I see it, the intended behavior of
org-insert-heading-respect-content with point before the first heading
is to

- insert the new heading immediately before the first heading.  Respect
  the content!

- If there is no heading at all in the file the heading shall be
  inserted at the bottom of the file.

Do we agree on the desired behavior of

With your proposition the respect for the content gets lost, doesn't it?


  reply	other threads:[~2021-09-13 19:23 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-09 14:55 Victor A. Stoichita
2021-09-09 18:54 ` Marco Wahl
2021-09-09 19:29   ` Victor A. Stoichita
2021-09-13 19:21     ` Marco Wahl [this message]
2021-09-17 15:23       ` Victor A. Stoichita
2021-09-18 13:08         ` Marco Wahl
2021-09-26 11:13           ` Bastien
2021-09-26 12:13             ` Marco Wahl
2021-09-26 12:31               ` Bastien
2021-09-26 19:57           ` Victor A. Stoichita

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:

  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=875yv4uvqr.fsf@gmail.com \
    --to=marcowahlsoft@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=victor@svictor.net \
    --subject='Re: behavior of (org-insert-heading-respect-content)' \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Code repositories for project(s) associated with this inbox:


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).