From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Tino Calancha Newsgroups: gmane.emacs.bugs Subject: bug#26338: 26.0.50; Collect all matches for REGEXP in current buffer Date: Fri, 7 Apr 2017 19:06:30 +0900 (JST) Message-ID: References: <8737dr6kxx.fsf@calancha-pc> <87h926cvgl.fsf@localhost> <87k272ow7g.fsf@calancha-pc> <87fuhpcbem.fsf@localhost> <87lgrheyvn.fsf@calancha-pc> <87pogsmefn.fsf@jane> <874ly3vw1p.fsf@users.sourceforge.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; format=flowed; charset=US-ASCII X-Trace: blaine.gmane.org 1491559641 4872 195.159.176.226 (7 Apr 2017 10:07:21 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 7 Apr 2017 10:07:21 +0000 (UTC) User-Agent: Alpine 2.20 (DEB 67 2015-01-07) Cc: 26338@debbugs.gnu.org, Tino Calancha , Marcin Borkowski , Juri Linkov To: npostavs@users.sourceforge.net Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Apr 07 12:07:13 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cwQnO-0008Fy-Fn for geb-bug-gnu-emacs@m.gmane.org; Fri, 07 Apr 2017 12:07:10 +0200 Original-Received: from localhost ([::1]:49846 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cwQnR-000518-Cv for geb-bug-gnu-emacs@m.gmane.org; Fri, 07 Apr 2017 06:07:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43992) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cwQnL-000512-Pa for bug-gnu-emacs@gnu.org; Fri, 07 Apr 2017 06:07:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cwQnG-0000Mx-OU for bug-gnu-emacs@gnu.org; Fri, 07 Apr 2017 06:07:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:37557) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cwQnG-0000Mq-K2 for bug-gnu-emacs@gnu.org; Fri, 07 Apr 2017 06:07:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cwQnG-0000dA-8h for bug-gnu-emacs@gnu.org; Fri, 07 Apr 2017 06:07:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Tino Calancha Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 07 Apr 2017 10:07:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 26338 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 26338-submit@debbugs.gnu.org id=B26338.14915596012397 (code B ref 26338); Fri, 07 Apr 2017 10:07:02 +0000 Original-Received: (at 26338) by debbugs.gnu.org; 7 Apr 2017 10:06:41 +0000 Original-Received: from localhost ([127.0.0.1]:35756 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cwQmv-0000cb-B8 for submit@debbugs.gnu.org; Fri, 07 Apr 2017 06:06:41 -0400 Original-Received: from mail-pg0-f42.google.com ([74.125.83.42]:34881) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cwQmt-0000cP-PC for 26338@debbugs.gnu.org; Fri, 07 Apr 2017 06:06:40 -0400 Original-Received: by mail-pg0-f42.google.com with SMTP id 81so62525885pgh.2 for <26338@debbugs.gnu.org>; Fri, 07 Apr 2017 03:06:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=YXyovoUuEil1X1I6jY8aKUZK9u85O8E1mosauz8jPEA=; b=gJq52jnSxv7SRpY+wIChnW+FPGnphZVuOoGtoN5QY7O7k+l0zgN9mbGHbUzVGjVwFN JNlydnavfZIlElbgMTKXvmgerkksfvsH3P5C7k4/22Fr1JlOlMuykCXAIw5/pvnIBOPw uCT6vxV8eOJnbGQBwPQQueLQizdkCLyEecHukEfzKaLKZTvzkkrlPJLGxhpeHLZtAxhK oGO4BV58u4xwRA0amDqM3exuDEOJB1FRZFMRgK8fsO13FrHiBgo9K5dKYK+xm0yFOgeh B5KcpdGLznZP5OSTaQaikWWWUBt4wEvC3J3v2kbOw4CJjQjVdgU6G4akWDTjJBLPgMph GZdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=YXyovoUuEil1X1I6jY8aKUZK9u85O8E1mosauz8jPEA=; b=cHI5J5OhPZwEOPtbKiy4+RgYrYST98loJzi4gIbawkTzWSL59g2fpTkgOLv4qxfzr1 AdPNagjMByLRdI5r2IwyRbQlZAOH+QRJw7lJAFHK5JN65hga2wRYMUwAMIzdyHxik+Ws h7b2L8i5VOjg7ID0FZjNLhLlvyFJCM+CCAS27+6X9OJSmR9VQzy2Ax70cwrguxO7t5+m bvDQakJclOTTLO5FzzHvgI0y2SyZKM/nhYrNFM7VlUJ8JFeAu/lyeXYAgAqyOYzpHQsh bE2CVmpSQQvoVyn1m+QFarTj3CJp9fzTBvVdncWxl4KnXPrtBbYh3j4HV0yPWPG0XtzR 0V0g== X-Gm-Message-State: AFeK/H27xCNx7oAGfIh0wtcjwzxryAUtGZMN+p2r3i4hIfed9ZCJFTnE/5e6Odec/uD7gQ== X-Received: by 10.99.8.67 with SMTP id 64mr35813568pgi.220.1491559594031; Fri, 07 Apr 2017 03:06:34 -0700 (PDT) Original-Received: from calancha-pc (222.139.137.133.dy.bbexcite.jp. [133.137.139.222]) by smtp.gmail.com with ESMTPSA id q64sm8634943pfi.69.2017.04.07.03.06.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 Apr 2017 03:06:33 -0700 (PDT) X-Google-Original-From: Tino Calancha X-X-Sender: calancha@calancha-pc In-Reply-To: <874ly3vw1p.fsf@users.sourceforge.net> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:131331 Archived-At: On Wed, 5 Apr 2017, npostavs@users.sourceforge.net wrote: > Tino Calancha 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 :-)