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: RE: commands to remove commented lines from grep output Date: Mon, 2 Jul 2007 15:58:11 -0700 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-15" Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1183417116 13735 80.91.229.12 (2 Jul 2007 22:58:36 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 2 Jul 2007 22:58:36 +0000 (UTC) Cc: emacs-devel@gnu.org To: Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jul 03 00:58:34 2007 connect(): Connection refused Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1I5Uqn-0006FT-Py for ged-emacs-devel@m.gmane.org; Tue, 03 Jul 2007 00:58:34 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1I5Uqn-00070q-EH for ged-emacs-devel@m.gmane.org; Mon, 02 Jul 2007 18:58:33 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1I5Uqj-00070l-Si for emacs-devel@gnu.org; Mon, 02 Jul 2007 18:58:29 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1I5Uqh-00070Z-Ur for emacs-devel@gnu.org; Mon, 02 Jul 2007 18:58:29 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1I5Uqh-00070W-QL for emacs-devel@gnu.org; Mon, 02 Jul 2007 18:58:27 -0400 Original-Received: from rgminet01.oracle.com ([148.87.113.118]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1I5Uqg-0008Ts-Ca; Mon, 02 Jul 2007 18:58:26 -0400 Original-Received: from rgmgw2.us.oracle.com (rgmgw2.us.oracle.com [138.1.186.111]) by rgminet01.oracle.com (Switch-3.2.4/Switch-3.1.6) with ESMTP id l62MwOrn023139; Mon, 2 Jul 2007 16:58:24 -0600 Original-Received: from acsmt351.oracle.com (acsmt351.oracle.com [141.146.40.151]) by rgmgw2.us.oracle.com (Switch-3.2.4/Switch-3.1.7) with ESMTP id l62Jv5ae023436; Mon, 2 Jul 2007 16:58:23 -0600 Original-Received: from dhcp-4op11-4op12-west-130-35-178-179.us.oracle.com by acsmt350.oracle.com with ESMTP id 3007124031183417093; Mon, 02 Jul 2007 15:58:13 -0700 X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.6604 (9.0.2911.0) In-Reply-To: X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3138 Importance: Normal X-Brightmail-Tracker: AAAAAQAAAAI= X-Brightmail-Tracker: AAAAAQAAAAI= X-Whitelist: TRUE X-Whitelist: TRUE X-detected-kernel: Linux 2.4-2.6 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:74213 Archived-At: > I sometimes want to see grep matches only for lines of code > that are not commented out. At least for the simple case of > single line comment syntax, such as `;' in Lisp and `//' in > C++, this is easy to do with `flush-lines'. > > As a general feature, it seems useful. > > To make this a little more convenient, I bind a more specific > command that does this to `;' in *grep* buffers. Another command, > bound to `M-;', toggles automatic removal of such commented lines. > > I am not sure I like that interface for it. Also, it doesn't work for C. > It could be made to work for C with more code, which would involve > reading the source files and checking whether the lines found are > inside comments. > > It seems to me that a new grep option might be a better approach. Do you mean, for example, automatically tweaking the regexp supplied to grep, so that commented lines are not included? That would be good, especially if it could handle lines commented between /* and */ (for C). It would still be good to supply a toggle for this automatic removal.