From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: proposal: defconst/defcustom org-tags-regexp Date: Thu, 19 Jul 2007 17:08:48 +0200 Message-ID: <20ed9633cd33f9824fae1ae6c47c9159@science.uva.nl> References: <20070716132118.GA28297@atlantic.linksys.moosehall> <56626b2502c1e0ead302243cb947b0b2@science.uva.nl> Mime-Version: 1.0 (Apple Message framework v624) Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IBXcY-0003TK-IB for emacs-orgmode@gnu.org; Thu, 19 Jul 2007 11:08:50 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IBXcY-0003T8-0P for emacs-orgmode@gnu.org; Thu, 19 Jul 2007 11:08:50 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IBXcX-0003T5-Pg for emacs-orgmode@gnu.org; Thu, 19 Jul 2007 11:08:49 -0400 Received: from mailer.mpia-hd.mpg.de ([149.217.40.2]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1IBXcX-0006fe-1R for emacs-orgmode@gnu.org; Thu, 19 Jul 2007 11:08:49 -0400 In-Reply-To: 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: Eddward DeVilla Cc: org-mode mailing list On Jul 19, 2007, at 15:08, Eddward DeVilla wrote: > On 7/18/07, Carsten Dominik wrote: >> Do you know a solution for this problem? > > Does emacs let you manually compile a regular expression? If so, it > might be possible to recompile REs when ever they change. This is not the issue. Yes, Emacs compiles regular expressions whenever necessary. However, consider the following loop: (while (re-search-forward "^aaa" nil t) (do-something) In this case, Emacs will compile the regexp once and then use it potentially many times. However, in the following case: (while (re-search-forward (concat "^" some-variable) nil t) (do-something) The regular expression wil be re-compiled all the time. In this case you can work around it by doing: (let ((re (concat "^" some-variable))) (while (re-search-forward re nil t) (do-something...)) But if the loop is calling functions, and the regular expression is being built and used in those functions, this might slow down things. Now, I am not sure how slow actually, I am basically following the arguments in Jeffrey E. F. Friedl's excellent book "Mastering Regular Expressions", but I am not sure how large the effect will be in the end. I remember that in perl this was significant, so I am assuming it is in Emacs. I would like to factor out more regexps into variables, and may do so with time - but this does not have priority. - Carsten -- Carsten Dominik Sterrenkundig Instituut "Anton Pannekoek" Universiteit van Amsterdam Kruislaan 403 NL-1098SJ Amsterdam phone: +31 20 525 7477