[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#26338: 26.0.50; Collect all matches for REGEXP in current buffer
From: |
Tino Calancha |
Subject: |
bug#26338: 26.0.50; Collect all matches for REGEXP in current buffer |
Date: |
Wed, 5 Apr 2017 20:58:51 +0900 (JST) |
User-agent: |
Alpine 2.20 (DEB 67 2015-01-07) |
On Tue, 4 Apr 2017, Marcin Borkowski wrote:
Any interest in something like this?:
(defmacro with-collect-matches (regexp &optional group &rest body)
"Collect matches for REGEXP and eval BODY for each match.
BODY is evaluated with `it' bound to the match.
Optional GROUP if non-nil, then is the regexp group to save. Otherwise,
save the whole match."
Sorry if this was said already, but why a macro and not a map-like
function?
No special reason. It's the second idea which came to my mind after
my initial proposal was declined. Maybe because is shorter to do:
(with-collect-matches regexp)
than
(foo-collect-matches regexp nil #'identity)
if you are just interested in the list of matches. Implementing it as
a map function might be also nice. Don't see a big enthusiasm on
the proposal, though :-(
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.
I will repeat it once more. I find nice, having an operator returning a
list with matches for REGEXP. If such operator, in addition, accepts a
body of code or a function, then i find this operator very nice
and elegant.
Regards,
Tino
- bug#26338: 26.0.50; Collect all matches for REGEXP in current buffer, Tino Calancha, 2017/04/02
- bug#26338: 26.0.50; Collect all matches for REGEXP in current buffer, Dmitry Gutov, 2017/04/02
- bug#26338: 26.0.50; Collect all matches for REGEXP in current buffer, Juri Linkov, 2017/04/02
- bug#26338: 26.0.50; Collect all matches for REGEXP in current buffer, Tino Calancha, 2017/04/03
- bug#26338: 26.0.50; Collect all matches for REGEXP in current buffer, Tino Calancha, 2017/04/03
- bug#26338: 26.0.50; Collect all matches for REGEXP in current buffer, Juri Linkov, 2017/04/03
- bug#26338: 26.0.50; Collect all matches for REGEXP in current buffer, Tino Calancha, 2017/04/03
- bug#26338: 26.0.50; Collect all matches for REGEXP in current buffer, Tino Calancha, 2017/04/03
- bug#26338: 26.0.50; Collect all matches for REGEXP in current buffer, Marcin Borkowski, 2017/04/04
- bug#26338: 26.0.50; Collect all matches for REGEXP in current buffer,
Tino Calancha <=
- bug#26338: 26.0.50; Collect all matches for REGEXP in current buffer, npostavs, 2017/04/05
- bug#26338: 26.0.50; Collect all matches for REGEXP in current buffer, Tino Calancha, 2017/04/07
- bug#26338: 26.0.50; Collect all matches for REGEXP in current buffer, Drew Adams, 2017/04/07
- bug#26338: 26.0.50; Collect all matches for REGEXP in current buffer, Tino Calancha, 2017/04/08
- bug#26338: 26.0.50; Collect all matches for REGEXP in current buffer, Drew Adams, 2017/04/08
- bug#26338: 26.0.50; Collect all matches for REGEXP in current buffer, Tino Calancha, 2017/04/08
- bug#26338: 26.0.50; Collect all matches for REGEXP in current buffer, Drew Adams, 2017/04/08
- bug#26338: 26.0.50; Collect all matches for REGEXP in current buffer, Philipp Stephani, 2017/04/08
- bug#26338: 26.0.50; Collect all matches for REGEXP in current buffer, Tino Calancha, 2017/04/08
- bug#26338: 26.0.50; Collect all matches for REGEXP in current buffer, Philipp Stephani, 2017/04/08