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: Mon, 03 Apr 2017 15:13:07 +0900 Message-ID: <87k272ow7g.fsf@calancha-pc> References: <8737dr6kxx.fsf@calancha-pc> <87h926cvgl.fsf@localhost> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1491200055 4886 195.159.176.226 (3 Apr 2017 06:14:15 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 3 Apr 2017 06:14:15 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) Cc: 26338@debbugs.gnu.org To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Apr 03 08:14:11 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 1cuvFi-0000en-Ke for geb-bug-gnu-emacs@m.gmane.org; Mon, 03 Apr 2017 08:14:10 +0200 Original-Received: from localhost ([::1]:57710 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cuvFm-00072Q-Ok for geb-bug-gnu-emacs@m.gmane.org; Mon, 03 Apr 2017 02:14:14 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54215) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cuvFe-00070l-5x for bug-gnu-emacs@gnu.org; Mon, 03 Apr 2017 02:14:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cuvFb-0001Cm-14 for bug-gnu-emacs@gnu.org; Mon, 03 Apr 2017 02:14:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:59871) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cuvFa-0001Cf-T6 for bug-gnu-emacs@gnu.org; Mon, 03 Apr 2017 02:14:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cuvFa-0004MI-Hl for bug-gnu-emacs@gnu.org; Mon, 03 Apr 2017 02:14: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: Mon, 03 Apr 2017 06:14: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.149119999916698 (code B ref 26338); Mon, 03 Apr 2017 06:14:02 +0000 Original-Received: (at 26338) by debbugs.gnu.org; 3 Apr 2017 06:13:19 +0000 Original-Received: from localhost ([127.0.0.1]:58070 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cuvEt-0004LG-Kf for submit@debbugs.gnu.org; Mon, 03 Apr 2017 02:13:19 -0400 Original-Received: from mail-pg0-f54.google.com ([74.125.83.54]:32993) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cuvEs-0004Kz-5V for 26338@debbugs.gnu.org; Mon, 03 Apr 2017 02:13:18 -0400 Original-Received: by mail-pg0-f54.google.com with SMTP id x125so110120187pgb.0 for <26338@debbugs.gnu.org>; Sun, 02 Apr 2017 23:13:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=EHR4BaC/sPZ4/gCGjGxDEWp07qZ5Q+39vPVWodQwGuw=; b=qWxF4R4eSq5GMbzDD6PvAWqaj+6GV4xhIzJwfKuftNbmd9Gs4WnqK2kNL3TX6hoZQM TDhOpcZRT8TG2sWbDjpxArgLY6L7dKO1pVnx+7ep1Z8dc3rzUT5Clprcedr3YU+UFvmc /rppscLL/OZgXD1AxdZVtiXgHd6JhRYmlShuhfZumPbXBwHPPChCToeubYCRJ6ejUNzt dxRzQ4spW+F8hv3km5TBbEhLpMjQ364vMcllXkQUvfPgLsVDTBONQi81HoTPen9CYw13 KCwyuisqFEScFJ7veEPcOLF77FddxE7DZ0NMOuh38johb8Aymz+SsB1QjdnhFDeBnHMg vUIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=EHR4BaC/sPZ4/gCGjGxDEWp07qZ5Q+39vPVWodQwGuw=; b=Huqw4j2O2xQgjRAehm56JF0Q+KApue3KG+3r3zpnRkbbVlOK0UaoZiTyrq+nxCr1vV JRA6Qraf0RwIx/isexB2j9cjFczL3V7CSQVoKowk5C0PZ+A1lmuD9aRQaLOeAW5SH4XJ nP8y5AxFrW/RqrQlj+GHU3ufV+lffNnLefNP3iLwTRy7Mrf6Tc2n6U62ibj7clk92UaJ x0y0mmY4iH7COPnv/+T6eAAHnTfbo1wRhH+b4Irpe3Gt1bT22rhoCAvNm6jrrCgvK3SD cPtZ4rzfW4a7P8bRltzvxSM0G++LXQ4lJwnn+iBn+kt/a8vcxt/me4fllmwOTHW2i/vo vLzg== X-Gm-Message-State: AFeK/H3mvUNIsOZRCkFVexIDh8u2empsEzJiCzu0Y8Ilv3YruL2ymrE23S/NKaKShZQkEw== X-Received: by 10.99.99.135 with SMTP id x129mr16065676pgb.121.1491199992556; Sun, 02 Apr 2017 23:13:12 -0700 (PDT) Original-Received: from calancha-pc (MAR89-178.kek.jp. [130.87.89.178]) by smtp.gmail.com with ESMTPSA id g5sm23228009pfe.12.2017.04.02.23.13.10 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 02 Apr 2017 23:13:11 -0700 (PDT) In-Reply-To: <87h926cvgl.fsf@localhost> (Juri Linkov's message of "Mon, 03 Apr 2017 01:10:02 +0300") 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:131239 Archived-At: Juri Linkov writes: >> we have `count-matches' in replace.el, which returns the >> number of matches of a regexp. Why not to have an standard >> function `collect-matches' as well? >> >> I know `xref-collect-matches' but it uses grep program: some users might >> not have grep installed, or they may prefer to use Emacs regexps. >> >> I've being using for a while something similar than the patch below. >> Probably it doesn't need to be a command, just a normal function. >> >> 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 more 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).