all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Tino Calancha <tino.calancha@gmail.com>
To: npostavs@users.sourceforge.net
Cc: 26338@debbugs.gnu.org, Tino Calancha <tino.calancha@gmail.com>,
	Marcin Borkowski <mbork@mbork.pl>, Juri Linkov <juri@linkov.net>
Subject: bug#26338: 26.0.50; Collect all matches for REGEXP in current buffer
Date: Fri, 7 Apr 2017 19:06:30 +0900 (JST)	[thread overview]
Message-ID: <alpine.DEB.2.20.1704071856590.23646@calancha-pc> (raw)
In-Reply-To: <874ly3vw1p.fsf@users.sourceforge.net>



On Wed, 5 Apr 2017, npostavs@users.sourceforge.net wrote:

> Tino Calancha <tino.calancha@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.
Your proposals looks nice to me ;-)
>
>> 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.
Sometimes i want to collect matches for different purposes; feed them into
another functions accepting a list.  That's why i miss a standard operator
collecting matches.  Sure, it can be done with a `while' loop, and 3-5
lines.  With the operator would be just one function call.

>> 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.
You know, the beauty is in the eyes watching.  The elegance too.  Maybe
you don't like the blue jersey i am wearing now; my mum made it
for me and i love it ;-)
Suppose depend on the name of the operator.  Not 
a sorprise if `collect-matches' collect matches;  a bit of sorprise if
`domatches' does such thing.
Thank you for your opinion :-)





  reply	other threads:[~2017-04-07 10:06 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-02 12:41 bug#26338: 26.0.50; Collect all matches for REGEXP in current buffer Tino Calancha
2017-04-02 15:57 ` Dmitry Gutov
2017-04-03  3:58   ` Tino Calancha
2017-04-02 22:10 ` Juri Linkov
2017-04-03  4:01   ` Tino Calancha
2017-04-03  6:13   ` Tino Calancha
2017-04-03 23:35     ` Juri Linkov
2017-04-04  1:37       ` Tino Calancha
2017-04-04  2:20         ` Tino Calancha
2017-04-04 14:32         ` Marcin Borkowski
2017-04-05 11:58           ` Tino Calancha
2017-04-05 13:11             ` npostavs
2017-04-07 10:06               ` Tino Calancha [this message]
2017-04-07 14:40                 ` Drew Adams
2017-04-08  4:45                   ` Tino Calancha
2017-04-08  5:49                     ` Drew Adams
2017-04-08 15:29                       ` Tino Calancha
2017-04-08 15:42                         ` Drew Adams
2017-04-08 11:46                     ` Philipp Stephani
2017-04-08 13:42                       ` Tino Calancha
2017-04-08 14:41                         ` Philipp Stephani
2017-04-08 15:20                           ` Tino Calancha
2017-04-22 19:42                             ` Philipp Stephani
2017-04-08 15:38                           ` npostavs
2017-04-22 19:36                             ` Philipp Stephani
2017-04-05 22:03             ` Juri Linkov
2017-04-07 14:47               ` Tino Calancha
2017-04-07 15:28                 ` Noam Postavsky
2017-04-07 15:54                   ` Drew Adams
2017-04-08 13:49                   ` Tino Calancha
2020-09-15 15:41 ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.20.1704071856590.23646@calancha-pc \
    --to=tino.calancha@gmail.com \
    --cc=26338@debbugs.gnu.org \
    --cc=juri@linkov.net \
    --cc=mbork@mbork.pl \
    --cc=npostavs@users.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.