From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#26338: 26.0.50; Collect all matches for REGEXP in current buffer Date: Tue, 04 Apr 2017 02:35:29 +0300 Organization: LINKOV.NET Message-ID: <87fuhpcbem.fsf@localhost> References: <8737dr6kxx.fsf@calancha-pc> <87h926cvgl.fsf@localhost> <87k272ow7g.fsf@calancha-pc> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1491262642 10302 195.159.176.226 (3 Apr 2017 23:37:22 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 3 Apr 2017 23:37:22 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (x86_64-pc-linux-gnu) Cc: 26338@debbugs.gnu.org To: Tino Calancha Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Apr 04 01:37:15 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 1cvBX1-0001KP-WC for geb-bug-gnu-emacs@m.gmane.org; Tue, 04 Apr 2017 01:37:08 +0200 Original-Received: from localhost ([::1]:33308 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cvBX7-0004ow-Tc for geb-bug-gnu-emacs@m.gmane.org; Mon, 03 Apr 2017 19:37:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60244) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cvBWz-0004mR-Kk for bug-gnu-emacs@gnu.org; Mon, 03 Apr 2017 19:37:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cvBWw-0007Da-IO for bug-gnu-emacs@gnu.org; Mon, 03 Apr 2017 19:37:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:33178) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cvBWw-0007DS-FD for bug-gnu-emacs@gnu.org; Mon, 03 Apr 2017 19:37:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cvBWw-0005pY-9V for bug-gnu-emacs@gnu.org; Mon, 03 Apr 2017 19:37:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 03 Apr 2017 23:37: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.149126261722392 (code B ref 26338); Mon, 03 Apr 2017 23:37:02 +0000 Original-Received: (at 26338) by debbugs.gnu.org; 3 Apr 2017 23:36:57 +0000 Original-Received: from localhost ([127.0.0.1]:59610 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cvBWr-0005p6-8R for submit@debbugs.gnu.org; Mon, 03 Apr 2017 19:36:57 -0400 Original-Received: from sub3.mail.dreamhost.com ([69.163.253.7]:50699 helo=homiemail-a19.g.dreamhost.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cvBWp-0005os-MY for 26338@debbugs.gnu.org; Mon, 03 Apr 2017 19:36:56 -0400 Original-Received: from homiemail-a19.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a19.g.dreamhost.com (Postfix) with ESMTP id 87DD4604090; Mon, 3 Apr 2017 16:36:54 -0700 (PDT) Original-Received: from localhost.linkov.net (m83-179-201-25.cust.tele2.ee [83.179.201.25]) (Authenticated sender: jurta@jurta.org) by homiemail-a19.g.dreamhost.com (Postfix) with ESMTPA id A3363604088; Mon, 3 Apr 2017 16:36:53 -0700 (PDT) In-Reply-To: <87k272ow7g.fsf@calancha-pc> (Tino Calancha's message of "Mon, 03 Apr 2017 15:13:07 +0900") 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:131250 Archived-At: >>> What do you think? >> >> But there is already the occur-collect feature implemented in occur-1 >> and occur-read-primary-args. Why would we need a separate command? > Indeed i don't think we need a new command for this. I am thinking mor= e > in an standard function. > Following: > (occur "defun\\s +\\(\\S +\\)" "\\1") > > doesn't return the collected things. It writes the matches in *Occur* > buffer. Then, if you want a list with the matches you must loop > again inside *Occur* which is sub-optimal. > For me, it has sense to have a `occur-collect' which just returns the > list of matches. > Then, we might use such function in the implementation of occur-1 > which could bring a cleaner implementation. > We might get also the LIMIT argument for occur which might come > in handy for multi-occur with lot of input buffers (just an idea). occur-collect is intended for interactive use. As for programmatic use, Dmitry is right: a universal idiom is (while (re-search-forward ...)). This is why e.g. the docstring of =E2=80=98replace-regexp=E2=80=99 recomm= ends to use an explicit loop like (while (re-search-forward ...) (replace-match ...))