From mboxrd@z Thu Jan 1 00:00:00 1970 From: Adam Spiers Subject: Re: proposal: defconst/defcustom org-tags-regexp Date: Fri, 20 Jul 2007 16:05:13 +0100 Message-ID: <20070720150513.GB28297@atlantic.linksys.moosehall> References: <20070716132118.GA28297@atlantic.linksys.moosehall> <56626b2502c1e0ead302243cb947b0b2@science.uva.nl> Reply-To: Adam Spiers Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IBu2h-00055n-7E for emacs-orgmode@gnu.org; Fri, 20 Jul 2007 11:05:19 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IBu2g-00055b-L9 for emacs-orgmode@gnu.org; Fri, 20 Jul 2007 11:05:18 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IBu2g-00055Y-I4 for emacs-orgmode@gnu.org; Fri, 20 Jul 2007 11:05:18 -0400 Received: from mail.beimborn.com ([70.84.38.100]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1IBu2g-00033M-1p for emacs-orgmode@gnu.org; Fri, 20 Jul 2007 11:05:18 -0400 Received: from mail.beimborn.com (localhost.localdomain [127.0.0.1]) by mail.beimborn.com (8.12.11.20060308/8.12.8) with ESMTP id l6KF5Foa007200 for ; Fri, 20 Jul 2007 10:05:15 -0500 Received: from localhost (localhost [[UNIX: localhost]]) by mail.beimborn.com (8.12.11.20060308/8.12.11/Submit) id l6KF5FoF007189 for emacs-orgmode@gnu.org; Fri, 20 Jul 2007 16:05:15 +0100 Content-Disposition: inline In-Reply-To: <56626b2502c1e0ead302243cb947b0b2@science.uva.nl> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: org-mode mailing list 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