Subject: Re: bug#26338: 26.0.50; Collect all matches for REGEXP in current buffer

From: Noam Postavsky <[email-masked]>
Date: Fri, 7 Apr 2017 11:28:46 -0400

On Fri, Apr 7, 2017 at 10:47 AM, Tino Calancha <[email-masked]> wrote:
> +
> +@example
> +(cl-loop for x being the matches of "^(defun \\(\\S +\\)"
> +         using '(group 1 limit 10)
> +         collect x)
> +@end example

You can reuse the existing 'repeat N' clause instead of 'using (limit N)'.

(cl-loop for x being the matches of "^(defun \\(\\S +\\)" using (group 1)
         repeat 10
         collect x)

Regarding Drew's concerns about extending cl-loop with more non-Common
Lisp things, I just don't see that as a problem. I suppose it would be
nice to have a more easily extensible looping macro, like iterate [1].
That would be quite a bit of work though.

[1]: https://common-lisp.net/project/iterate/