Hi Nicolas On Sat, Nov 23, 2013 at 11:52 AM, Nicolas Goaziou <n.goaz...@gmail.com> wrote: > I pushed a fix that should halve the time,
I see this effect, thank you. > but it will still be slow. > > `org-element-at-point' is linear by the number of elements before point > in the current section. Therefore, parsing /all/ elements in a section > will be quadratic by the number of elements in the section. To avoid the quadratic scaling in my use case of "fileconversion" I think fileconversion should be improved to insert the leading stars _before_ Org mode has finished turning on. In the past org-mode-hook was simply used but it seems to have become the wrong choice for my purpose. First, I have an understanding question: I tried to find where org-mode-hook is called within the function org-mode but could not see something similar to the expected "(run-hooks 'org-mode-hook)". So I added 'backtrace to the org-mode-hook but don't understand it either: (backtrace) backtrace() run-hooks(change-major-mode-after-body-hook text-mode-hook outline-mode-hook org-mode-hook) apply(run-hooks (change-major-mode-after-body-hook text-mode-hook outline-mode-hook org-mode-hook)) run-mode-hooks(org-mode-hook) org-mode() [...] I see the expected "run-mode-hooks(org-mode-hook)" in this backtrace but where is the corresponding form in the function org-mode? Second, I guess it is not necessary to implement something like org-mode-early-hook but I could not find yet an existing hook. Which hook would you recommend for inserting the leading stars? Michael