[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Orgmode] proposal: defconst/defcustom org-tags-regexp

From: Adam Spiers
Subject: Re: [Orgmode] proposal: defconst/defcustom org-tags-regexp
Date: Fri, 20 Jul 2007 16:05:13 +0100
User-agent: Mutt/1.5.14 (2007-02-12)

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?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]