emacs-devel
[Top][All Lists]
Advanced

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

Re: Inefficient code in reftex-index.el


From: Kim F. Storm
Subject: Re: Inefficient code in reftex-index.el
Date: Wed, 08 Jun 2005 10:44:44 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

Stefan Monnier <address@hidden> writes:

>>> There is no other interface into the number of accessible match
>>> strings (which might be nil) rather than
>>> (/ (length (match-data t)) 2).
>
>>     That's still pretty inefficient -- I suggest that we introduce a new
>>     function `match-count' to return that number.
>
>> Is there sufficient use for this function to justify introducing it?
>> I think that most cases where this would be used, the code would
>> then proceed to call match-data.
>
> 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).

Maybe this would be more versatile:

(match-subgroups)   => "match count"
(match-subgroups t) => list of subgroups that matches

-- 
Kim F. Storm <address@hidden> http://www.cua.dk





reply via email to

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