On 14.11.2013, at 23:53, Bastien <b...@gnu.org> wrote: > Hi Nicolas, > > Nicolas Goaziou <n.goaz...@gmail.com> writes: > >>> Confirmed -- I quickly looked, it seems that `org-in-item-p' should do >>> a better job when preceeded by invisible text. >> >> I need to rewrite this function. >> >> Anyway, I'm not sure what you mean in your last sentence because, as >> a low-level function, its results shouldn't be affected by folding >> status of the document (I didn't follow the thread closely, though, and >> could be off tracks). > > The problem is this one: > > * Folded subtree... > > ^-{ Point here > > then M-x org-insert-heading RET will *not* insert a heading if the > folded subtree is ending with a list, because `org-in-item-p' will > infer point is within a list.
I think it is dangerous to change the behavior in such a way that it will depend on the heading being folded or not. Definitely org-in-item-p should not depend on that. I am still debating with myself if org-insert-heading should. Maybe only in interactive use or something like that. Dangerous territory. - Carsten > > So maybe `org-insert-heading' should be fixed instead, as a higher > level function, ignoring the folded content before the point? > > -- > Bastien >