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: Wed, 5 Apr 2017 20:58:51 +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> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed X-Trace: blaine.gmane.org 1491393633 16485 195.159.176.226 (5 Apr 2017 12:00:33 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 5 Apr 2017 12:00:33 +0000 (UTC) User-Agent: Alpine 2.20 (DEB 67 2015-01-07) Cc: 26338@debbugs.gnu.org, Tino Calancha , Juri Linkov To: Marcin Borkowski Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Apr 05 14:00:24 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 1cvjbn-000312-7k for geb-bug-gnu-emacs@m.gmane.org; Wed, 05 Apr 2017 14:00:19 +0200 Original-Received: from localhost ([::1]:40021 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cvjbt-0007dC-6c for geb-bug-gnu-emacs@m.gmane.org; Wed, 05 Apr 2017 08:00:25 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57374) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cvjbe-0007Wy-5u for bug-gnu-emacs@gnu.org; Wed, 05 Apr 2017 08:00:15 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cvjbZ-0000bo-Bh for bug-gnu-emacs@gnu.org; Wed, 05 Apr 2017 08:00:10 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:35074) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cvjbZ-0000bg-8V for bug-gnu-emacs@gnu.org; Wed, 05 Apr 2017 08:00:05 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cvjbX-000374-BN for bug-gnu-emacs@gnu.org; Wed, 05 Apr 2017 08:00:04 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Tino Calancha Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 05 Apr 2017 12:00:03 +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.149139354211855 (code B ref 26338); Wed, 05 Apr 2017 12:00:03 +0000 Original-Received: (at 26338) by debbugs.gnu.org; 5 Apr 2017 11:59:02 +0000 Original-Received: from localhost ([127.0.0.1]:33271 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cvjaX-000357-Tr for submit@debbugs.gnu.org; Wed, 05 Apr 2017 07:59:02 -0400 Original-Received: from mail-pg0-f67.google.com ([74.125.83.67]:32961) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cvjaW-00034p-A7 for 26338@debbugs.gnu.org; Wed, 05 Apr 2017 07:59:00 -0400 Original-Received: by mail-pg0-f67.google.com with SMTP id 79so1754823pgf.0 for <26338@debbugs.gnu.org>; Wed, 05 Apr 2017 04:59:00 -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=fmbO6BXjcRbFbPsblOjTPFWR/Pt7pZjewjEt3cKfNtM=; b=JUEYkRzTPM4qrOi6yhS5UecabA+es/glwLnxzyI9JfMLBthRir74GI0eoG3chXFzgx +2ZU3Tg+98jpjyuALU2t07+O1R78Ig/w1Ijaf7Ksg7u0NinAGNtpmVpQ3ZrUKQRKkZbt jVYyUUffc032t+hDHdBGoZLIQaPpULYcqdHFkexJHYSvYI0ktJfAfgTk2pySb7TjnR00 duv0DaFLp+a2Idj5xKDuwv+RdkppeYFpDirZQOKHBe7hV2MU1ruWGuYIEidF1Bt34388 xRGsY0PKerIEkHe34UrNARRUGRs8RTiUN7shfBRN+IqD0MKriO27sSAeLjFLMw09Z1GF h2oQ== 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=fmbO6BXjcRbFbPsblOjTPFWR/Pt7pZjewjEt3cKfNtM=; b=UGUoAbJz8jwxDfFHhS7lDvBPR65Nti/Cw1RblkuYjtVHaxrpYUAFJgshIuPOFols8B G50pr+EZhv85GG+V7RdpAcAhw0hRpoEfLx1IXKSruWH1lH5kgEXFdboK3apqyuNe+o+6 dVsFow5NxsoihCnT8CaLHAIYNYLmxhc0mJzDMogW36G2RYB0iMZF+1C60wyK1sqpkrYj ql9yeCx8huESM3yC9H2+zg3nrWG10w50yxGTFiTWxuX1KP3FJIzT6JeKbEx6hXvYHXzZ g2sX3cnxgHpSNW1dSY/2sV3pY3J9rxWV4AA01tMciAi65n/YmARsWNxnG5fqbCmgUGZa UHGw== X-Gm-Message-State: AFeK/H2l8KF2IIypGRG7qAcTaNZs7BwZ9Iz88xDvtjd5J1VEVG9lp5AlLQ03xMaZ7lWj+A== X-Received: by 10.98.222.70 with SMTP id h67mr28590492pfg.43.1491393534487; Wed, 05 Apr 2017 04:58:54 -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 m194sm37381517pga.62.2017.04.05.04.58.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Apr 2017 04:58:53 -0700 (PDT) X-Google-Original-From: Tino Calancha X-X-Sender: calancha@calancha-pc In-Reply-To: <87pogsmefn.fsf@jane> 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:131285 Archived-At: On Tue, 4 Apr 2017, Marcin Borkowski wrote: >> Any interest in something like this?: >> >> (defmacro with-collect-matches (regexp &optional group &rest body) >> "Collect matches for REGEXP and eval BODY for each match. >> BODY is evaluated with `it' bound to the match. >> Optional GROUP if non-nil, then is the regexp group to save. Otherwise, >> save the whole match." > > Sorry if this was said already, but why a macro and not a map-like > function? No special reason. It's the second idea which came to my mind after my initial proposal was declined. Maybe because is shorter to do: (with-collect-matches regexp) than (foo-collect-matches regexp nil #'identity) if you are just interested in the list of matches. Implementing it as a map function might be also nice. Don't see a big enthusiasm on the proposal, though :-( 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. I will repeat it once more. I find nice, having an operator returning a list with matches for REGEXP. If such operator, in addition, accepts a body of code or a function, then i find this operator very nice and elegant. Regards, Tino