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

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

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. 


  reply	other threads:[~2021-09-09 19:32 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 [this message]
2021-09-13 19:21     ` Marco Wahl
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=87ilz98s5a.fsf@svictor.net \
    --to=victor@svictor.net \
    --cc=emacs-orgmode@gnu.org \
    --cc=marcowahlsoft@gmail.com \
    --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).