Le 09 Sep 2021, Marco Wahl <marcowahls...@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