Alan Schmitt <alan.schm...@polytechnique.org> writes:

> Should we assume the cookie is at the end of the headline or not?

The cookie can be anywhere within the headline text.

> I'd gladly do this, but to use the `org-element-map' function it seem
> that I need a parse tree. How can I get it? Or is it possible to use
> directly `org-element-map' on a buffer?

You don't need to use `org-element-map'[fn:1]. However, you cannot just use
`re-search-forward' either. You probably need to map over entries (e.g.,
with `org-map-entries'), apply some filter to current headline, and
compare it with link's path. This is slower than the current
implementation.

Another option would be to ignore only contents of statistics cookies,
not the whole cookie. This way we still can turn path into a proper
regexp.

WDYT?


Regards,

[fn:1] Btw, you get a parse tree with `org-element-parse-buffer'.

Reply via email to