emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: behavior of (org-insert-heading-respect-content)


From: Victor A. Stoichita
Subject: Re: behavior of (org-insert-heading-respect-content)
Date: Thu, 09 Sep 2021 21:29:05 +0200

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. 

Regards,
Victor



reply via email to

[Prev in Thread] Current Thread [Next in Thread]