On Wed, Jul 18, 2007 at 11:24:40PM +0200, Carsten Dominik wrote:
> On Jul 16, 2007, at 15:21, Adam Spiers wrote:
> >There seem to be a number of hardcoded regexps currently used for
> >matching heading tags, all very similar looking, and typically
> >something like:
> >
> >  [ \t]*\\(:[[:alnum:]_@:]+:\\)?[ \t]*\\($\\|\r\\)
> >
> >Is there any reason why these shouldn't be factored out into a new
> >defcustom org-tags-regexp?
> 
> Well, one reason is efficiency.  When a regular expression is a 
> constant,
> Emacs is able to cache the compiled version of the regular expression,
> and this can speed up code that does a lot of matching quite a bit.  The
> token you show above is usually part of a larger string, so the full
> regular expression would have to be make with concat and will therefore
> be recompiled all the time.

Right, point taken - like m//o in Perl.  To be honest, it doesn't
matter too much to me if it's defconst rather than defcustom.  The
main thing is that I can have tags starting with '<' :-)

I suggest that we start by refactoring into a defconst, and then we
can worry about turning that into a defcustom in a way which retains
efficiency at a later date - if anyone needs the defcustom badly
enough.  Makes sense?

Cheers,
Adam


_______________________________________________
Emacs-orgmode mailing list
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

Reply via email to