From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: David Kastrup Newsgroups: gmane.emacs.devel Subject: Re: Inefficient code in reftex-index.el Date: Wed, 08 Jun 2005 12:11:35 +0200 Message-ID: <85is0p9mzs.fsf@lola.goethe.zz> References: <85slzv7j87.fsf@lola.goethe.zz> <858y1n2g75.fsf@lola.goethe.zz> <85oeai1pwq.fsf@lola.goethe.zz> <878y1mkpy3.fsf-monnier+emacs@gnu.org> <85vf4p9o3g.fsf@lola.goethe.zz> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1118225662 23102 80.91.229.2 (8 Jun 2005 10:14:22 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 8 Jun 2005 10:14:22 +0000 (UTC) Cc: dominik@science.uva.nl, emacs-devel@gnu.org, Stefan Monnier , rms@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jun 08 12:14:20 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DfxZP-0001S5-9P for ged-emacs-devel@m.gmane.org; Wed, 08 Jun 2005 12:13:59 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Dfxg6-0000kZ-Bp for ged-emacs-devel@m.gmane.org; Wed, 08 Jun 2005 06:20:54 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Dfxdh-0000EC-8q for emacs-devel@gnu.org; Wed, 08 Jun 2005 06:18:25 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Dfxdf-0000DB-2o for emacs-devel@gnu.org; Wed, 08 Jun 2005 06:18:23 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Dfxdd-00005G-Un for emacs-devel@gnu.org; Wed, 08 Jun 2005 06:18:22 -0400 Original-Received: from [199.232.76.164] (helo=fencepost.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.34) id 1Dfxak-0003Mu-Mm for emacs-devel@gnu.org; Wed, 08 Jun 2005 06:15:22 -0400 Original-Received: from localhost ([127.0.0.1] helo=lola.goethe.zz) by fencepost.gnu.org with esmtp (Exim 4.34) id 1DfxVS-00033F-Ih; Wed, 08 Jun 2005 06:09:54 -0400 Original-Received: by lola.goethe.zz (Postfix, from userid 1002) id 7B65D1C3DFFF; Wed, 8 Jun 2005 12:11:35 +0200 (CEST) Original-To: storm@cua.dk (Kim F. Storm) In-Reply-To: (Kim F. Storm's message of "Wed, 08 Jun 2005 12:00:36 +0200") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:38309 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:38309 storm@cua.dk (Kim F. Storm) writes: > David Kastrup writes: > >>> Actually the only cases I can vaguely remember using the >>> (/ (length (match-data)) 2) idiom didn't use the whole (match-data). >>> They typically used the idiom in order to know *which* subgroup matched (of >>> course it only works if you craft your regexp carefully). >> >> That would not work. (length (match-data)) is a property of the >> regexp, not the match. > > According to the code, it does work. > > Match data only contains markers until the last successful match. (progn (string-match "\\(x\\)\\|\\(y\\)" "x") (match-data)) => (0 1 0 1) I stand corrected. Hey, can I rely on that? It would probably speed up some code of mine where I have to scan for the only non-nil match-beginning. -- David Kastrup, Kriemhildstr. 15, 44793 Bochum