GNU bug report logs -
#26338
26.0.50; Collect all matches for REGEXP in current buffer
Previous Next
Reported by: Tino Calancha <tino.calancha <at> gmail.com>
Date: Sun, 2 Apr 2017 12:42:01 UTC
Severity: wishlist
Tags: wontfix
Found in version 26.0.50
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
Tino Calancha <tino.calancha <at> gmail.com> writes:
>
> So far people think that it's easy to write a while loop. I wonder if
> they think the same about the existence of `dolist': the should
> never use it and always write a `while' loop instead. Don't think they
> do that anyway.
Perhaps a macro that loops over matches?
(defmacro domatches (spec &rest body)
"Loop over matches to REGEXP.
\(fn (MATCH-VAR [GROUP] REGEXP [BOUND]) BODY...)")
Or an addition to cl-loop that would allow doing something like
(cl-loop for m being the matches of "foo\\|bar"
do ...)
Then you could easily 'collect m' to get the list of matches if you want
that.
> I will repeat it once more. I find nice, having an operator returning
> a list with matches for REGEXP.
I don't think that's come up for me very much, if at all. It seems
easier to just operate on the matches directly rather than collecting
and then mapping.
> If such operator, in addition,
> accepts a body of code or a function, then i find this operator very
> nice
> and elegant.
Forcing collection on the looping operator seems inelegant to me.
This bug report was last modified 4 years and 250 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.