Richard Stallman <[EMAIL PROTECTED]> writes: > Certainly cleaner than the straw man you are trying to put up, no > question about that. > > It's not a straw man. It's what I'd expect most such cases to do. > > If it is very important to optimize your code, we could add a > function match-count to do so. But is it really that important to > optimize?
I think that if one has the situation of a number of strings and corresponding actions in a data structure, and one wants to repeatedly search for the next occurence of any matching string, and then do the recorded corresponding action, this would be a typical situation where match-count would be convenient. grepping through the Emacs tree suggests that this usage is not common, however. But I did see several occasions where match-count seemed appropriate as a loop limit for running through possible matched groups after a match. There is also the following in tramp.el: /home/tmp/emacs/lisp/net/tramp.el:6450: (let* ((nmatches (/ (length (match-data)) 2)) /home/tmp/emacs/lisp/net/tramp.el:6793: (setq len (/ (length (match-data t)) 2)) In particular the former usage suffers from the "trailing markers" slowdown. While it is something that should be fixed here, it would seem that the availability of match-count would have prevented this particular abuse. -- David Kastrup, Kriemhildstr. 15, 44793 Bochum _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-devel