|
From: | Dmitry Gutov |
Subject: | bug#26338: 26.0.50; Collect all matches for REGEXP in current buffer |
Date: | Sun, 2 Apr 2017 18:57:02 +0300 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.0 |
On 02.04.2017 15:41, Tino Calancha wrote:
we have `count-matches' in replace.el, which returns the number of matches of a regexp. Why not to have an standard function `collect-matches' as well? I know `xref-collect-matches' but it uses grep program: some users might not have grep installed, or they may prefer to use Emacs regexps. I've being using for a while something similar than the patch below. Probably it doesn't need to be a command, just a normal function. What do you think?
When used interactively, isn't M-x occur doing something like this?And for Elisp programs, (while (re-search-forward ...)) is usually sufficient. That's a three-liner at worst.
And I've never had a need to limit the number of matches, personally.
[Prev in Thread] | Current Thread | [Next in Thread] |