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: Sat, 8 Apr 2017 13:45:49 +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> <943bd0fd-c4ad-48f4-a803-f832b5bf0edf@default> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed X-Trace: blaine.gmane.org 1491626785 3791 195.159.176.226 (8 Apr 2017 04:46:25 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 8 Apr 2017 04:46:25 +0000 (UTC) User-Agent: Alpine 2.20 (DEB 67 2015-01-07) Cc: 26338@debbugs.gnu.org, npostavs@users.sourceforge.net, Marcin Borkowski , Tino Calancha , Juri Linkov To: Drew Adams Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Apr 08 06:46:18 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 1cwiGH-0007hk-25 for geb-bug-gnu-emacs@m.gmane.org; Sat, 08 Apr 2017 06:46:09 +0200 Original-Received: from localhost ([::1]:53506 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cwiGM-00062T-RR for geb-bug-gnu-emacs@m.gmane.org; Sat, 08 Apr 2017 00:46:14 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59961) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cwiGE-00062N-66 for bug-gnu-emacs@gnu.org; Sat, 08 Apr 2017 00:46:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cwiGB-0003Fy-2S for bug-gnu-emacs@gnu.org; Sat, 08 Apr 2017 00:46:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:38769) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cwiGA-0003Fs-UM for bug-gnu-emacs@gnu.org; Sat, 08 Apr 2017 00:46:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cwiGA-0000RX-It for bug-gnu-emacs@gnu.org; Sat, 08 Apr 2017 00:46: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: Sat, 08 Apr 2017 04:46: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.14916267611688 (code B ref 26338); Sat, 08 Apr 2017 04:46:02 +0000 Original-Received: (at 26338) by debbugs.gnu.org; 8 Apr 2017 04:46:01 +0000 Original-Received: from localhost ([127.0.0.1]:36968 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cwiG9-0000RA-Ay for submit@debbugs.gnu.org; Sat, 08 Apr 2017 00:46:01 -0400 Original-Received: from mail-pf0-f194.google.com ([209.85.192.194]:35438) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cwiG7-0000Qy-U4 for 26338@debbugs.gnu.org; Sat, 08 Apr 2017 00:46:00 -0400 Original-Received: by mail-pf0-f194.google.com with SMTP id n11so3002424pfg.2 for <26338@debbugs.gnu.org>; Fri, 07 Apr 2017 21:45:59 -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=WwRGZj+MFMDeAmy2/QWhYlDeYAERNLvzk5CoLKFGg1w=; b=lobHSQSKFRxtfQPgGKNLObyAXFgzdtRpvrdXwr2YUmeJIzAwTXJ2eKF8P3l+jMalhp UMpM0V2IidKZBWPjdTnEV2mB2f7s3BWnC57iPQVKuz4qAq6mfdOYFunkj+pLhBskpTGZ QvBPqZtSfgfiK/aKW+8Ueap4O7YEYrSvuCf5Fgah7gMtjgGiIVTJbWS6NF0H371o+FP3 +hv/SQ9N0EbCXsh5MfuhwI/fmSG56Siu6h+5RqKwjOYYAvGEIRiawHdHhxLzXAtyDF3/ RF8NaN9R8B0IgjNSHKgdsx7HmIAl0PsVNjkHWjBoAJGqwKCFJjRxfFhPBtu8PCWHAW5c 6rOg== 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=WwRGZj+MFMDeAmy2/QWhYlDeYAERNLvzk5CoLKFGg1w=; b=YV9nkKB4jMDddYZpXCl7AK8uU+reBzpQMuNKQ6gB+Ec5bjXVolRmCJwMAE2CG/TQKO 0hL6y5VoBm4DLFFx5qNxeq40sxjTXTBjRcnvmtbPL6uUGG6v4N89ZWn+UW4zrQV7cHu2 s+4wtSErIKGL4k91FAKJ3NONuPm+TN1mf7u8YuTSkSPzf4l5GnoI2trWQTZm9vSXCxD0 uL0rU5QY6DUohT4YftYCH5Dx+v6jCo6YD460orN0B6kQEmzhb/8eRx3eMN6ofiaysPwZ nrKGEPx26hCU0wjDBwJ24mvjUW6O6cWIKOmh6zLzDIzVSAIO4QvDI8zBLxXgAR16m0wZ +TgA== X-Gm-Message-State: AFeK/H1/viaGtax7UmW0PSfzZLToZuKyWgNZY9EutRm0UCB3fk+Bvp9tnTPKbi8AByUB4A== X-Received: by 10.98.68.82 with SMTP id r79mr45198886pfa.41.1491626754044; Fri, 07 Apr 2017 21:45: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 t187sm12191495pfb.116.2017.04.07.21.45.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 Apr 2017 21:45:53 -0700 (PDT) X-Google-Original-From: Tino Calancha X-X-Sender: calancha@calancha-pc In-Reply-To: <943bd0fd-c4ad-48f4-a803-f832b5bf0edf@default> 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:131347 Archived-At: On Fri, 7 Apr 2017, Drew Adams wrote: >>> 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 ;-) > > (Caveat: I have not been following this thread.) > > I think that `cl-loop' should be as close to Common Lisp `loop' > as we can reasonably make it. We should _not_ be adding other > features to it or changing its behavior away from what it is > supposedly emulating. > > If you want, create a _different_ macro that is Emacs-specific, > with whatever behavior you want. Call it whatever you want > that will not be confused with Common Lisp emulation. > > Please keep `cl-' for Common Lisp emulation. We've already > seen more than enough tampering with this - people adding > their favorite thing to the `cl-' namespace. Not good. Drew, i respect your opinion; but so far the change would just extend `cl-loop' which as you noticed has being already extended before. For instance, we have: cl-loop for x being the overlays/buffers ... Don't see a problem to have those things. We already point out in the manual that these are Emacs specific things, so nobody should be fooled with that. As far as we cover all CL clauses, what problem could be in having a few more? I find interesting be able to do things like the following: --8<-----------------------------cut here---------------start------------->8--- (require 'find-lisp) (let ((op "defun") (dir (expand-file-name "lisp" source-directory))) (setq funcs (cl-loop for f in (find-lisp-find-files dir "\.el\\'") nconc (with-temp-buffer (insert-file-contents-literally f) (let ((regexp (format "^(%s \\(\\S +\\)" op))) (cl-loop for x the matches of regexp using '(group 1) collect x))))) (length funcs)) => 38898 ; op: defun => 1256 ; op: defmacro => 1542 ; op: defsubst --8<-----------------------------cut here---------------end--------------->8---