From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Richard Stallman Newsgroups: gmane.emacs.devel Subject: Re: commands to remove commented lines from grep output Date: Mon, 02 Jul 2007 18:40:23 -0400 Message-ID: References: Reply-To: rms@gnu.org NNTP-Posting-Host: lo.gmane.org Content-Type: text/plain; charset=ISO-8859-15 X-Trace: sea.gmane.org 1183416157 4703 80.91.229.12 (2 Jul 2007 22:42:37 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 2 Jul 2007 22:42:37 +0000 (UTC) Cc: emacs-devel@gnu.org To: "Drew Adams" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jul 03 00:42:36 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 1I5UbH-00038c-OV for ged-emacs-devel@m.gmane.org; Tue, 03 Jul 2007 00:42:31 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1I5UbH-0003Gi-Ae for ged-emacs-devel@m.gmane.org; Mon, 02 Jul 2007 18:42:31 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1I5UZF-0002Pl-Ui for emacs-devel@gnu.org; Mon, 02 Jul 2007 18:40:26 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1I5UZF-0002Ot-AG for emacs-devel@gnu.org; Mon, 02 Jul 2007 18:40:25 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1I5UZE-0002OT-Ub for emacs-devel@gnu.org; Mon, 02 Jul 2007 18:40:24 -0400 Original-Received: from fencepost.gnu.org ([140.186.70.10]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1I5UZE-00050U-G4 for emacs-devel@gnu.org; Mon, 02 Jul 2007 18:40:24 -0400 Original-Received: from rms by fencepost.gnu.org with local (Exim 4.60) (envelope-from ) id 1I5UZD-0005Rj-VS; Mon, 02 Jul 2007 18:40:23 -0400 In-reply-to: X-detected-kernel: Linux 2.6, seldom 2.4 (older, 4) 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:74211 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.