bug-gnu-emacs
[Top][All Lists]
Advanced

[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: Noam Postavsky
Subject: bug#26338: 26.0.50; Collect all matches for REGEXP in current buffer
Date: Fri, 7 Apr 2017 11:28:46 -0400

On Fri, Apr 7, 2017 at 10:47 AM, Tino Calancha <address@hidden> wrote:
> +
> address@hidden
> +(cl-loop for x being the matches of "^(defun \\(\\S +\\)"
> +         using '(group 1 limit 10)
> +         collect x)
> address@hidden 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/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]