From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.devel Subject: grep command doc - point out that you can chain now Date: Sun, 16 Jul 2006 20:39:07 -0700 Message-ID: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1153107602 8129 80.91.229.2 (17 Jul 2006 03:40:02 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 17 Jul 2006 03:40:02 +0000 (UTC) Cc: Le Wang Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jul 17 05:40:00 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1G2JxU-00015n-3r for ged-emacs-devel@m.gmane.org; Mon, 17 Jul 2006 05:39:48 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1G2JxT-0004qx-IY for ged-emacs-devel@m.gmane.org; Sun, 16 Jul 2006 23:39:47 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1G2JxF-0004nJ-2I for emacs-devel@gnu.org; Sun, 16 Jul 2006 23:39:33 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1G2JxC-0004jl-Jr for emacs-devel@gnu.org; Sun, 16 Jul 2006 23:39:32 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1G2JxC-0004jc-Ey for emacs-devel@gnu.org; Sun, 16 Jul 2006 23:39:30 -0400 Original-Received: from [148.87.113.118] (helo=rgminet01.oracle.com) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.52) id 1G2Jzm-0007dG-8x for emacs-devel@gnu.org; Sun, 16 Jul 2006 23:42:10 -0400 Original-Received: from rcsmt251.oracle.com (rcsmt251.oracle.com [148.87.90.196]) by rgminet01.oracle.com (Switch-3.1.6/Switch-3.1.6) with ESMTP id k6GK8AXG002973; Sun, 16 Jul 2006 21:39:27 -0600 Original-Received: from dhcp-amer-csvpn-gw1-141-144-64-45.vpn.oracle.com by rcsmt251.oracle.com with ESMTP id 1573296151153107561; Sun, 16 Jul 2006 21:39:21 -0600 Original-To: "Emacs-Devel" X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.6604 (9.0.2911.0) Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1807 X-Whitelist: TRUE X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:57149 Archived-At: I just found out from Le Wang that you can now chain grep commands within the Emacs `grep' command. I mean that you can now do `M-x grep foo *.el | grep bar | grep toto'. This is absolutely wonderful. I don't know when it was added (I suspect Emacs 22) - it wasn't available in Emacs 20, in any case. (In Emacs 20, I've been using `M-!' to chain greps, or doing it outside Emacs. BTW, `flush-lines' doesn't work in *grep*, because it throws off the `next-error' index.) Chaining this way, in my experience, represents how most programmers use grep. Instead of trying to come up with a complex regexp, they just use two or three chained greps. The technique is so useful that I've applied it to the use of regexps generally (e.g. regexp searching) in my own libraries. So, I'm disappointed to see that this is not pointed out in the Emacs manual presentation of `grep'. I really think this is worth pointing out explicitly, with a simple example, especially since it was not possible before.