From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Highlighting in grep buffer Date: 08 Apr 2004 12:38:42 -0400 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <87isgafmte.fsf-monnier+emacs@alfajor.local> References: <87hdvvhzgh.fsf@mail.jurta.org> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1081442734 10227 80.91.224.253 (8 Apr 2004 16:45:34 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 8 Apr 2004 16:45:34 +0000 (UTC) Cc: rms@gnu.org, Drew Adams , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Thu Apr 08 18:45:27 2004 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1BBced-0007Rb-00 for ; Thu, 08 Apr 2004 18:45:27 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1BBcec-00071C-00 for ; Thu, 08 Apr 2004 18:45:26 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.30) id 1BBcbj-00080g-3M for emacs-devel@quimby.gnus.org; Thu, 08 Apr 2004 12:42:27 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30) id 1BBcbJ-000806-Cw for emacs-devel@gnu.org; Thu, 08 Apr 2004 12:42:01 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30) id 1BBcal-0007rm-Bu for emacs-devel@gnu.org; Thu, 08 Apr 2004 12:41:58 -0400 Original-Received: from [209.226.175.93] (helo=tomts36-srv.bellnexxia.net) by monty-python.gnu.org with esmtp (Exim 4.30) id 1BBcYJ-0007KN-0J; Thu, 08 Apr 2004 12:38:55 -0400 Original-Received: from alfajor ([67.71.119.143]) by tomts36-srv.bellnexxia.net (InterMail vM.5.01.06.05 201-253-122-130-105-20030824) with ESMTP id <20040408163841.NBWW1581.tomts36-srv.bellnexxia.net@alfajor>; Thu, 8 Apr 2004 12:38:41 -0400 Original-Received: by alfajor (Postfix, from userid 1000) id 18736D73B5; Thu, 8 Apr 2004 12:38:42 -0400 (EDT) Original-To: Juri Linkov In-Reply-To: <87hdvvhzgh.fsf@mail.jurta.org> Original-Lines: 24 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.4 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:21383 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:21383 > (defun grep-process-setup () > "Setup compilation variables and buffer for `grep'. > Set up `compilation-exit-message-function' and run `grep-setup-hook'." > + (setenv "GREP_OPTIONS" "--color=always") > + (setenv "GREP_COLOR" "01;31") > (set (make-local-variable 'compilation-exit-message-function) > (lambda (status code msg) > + (ansi-color-apply-on-region (point-min) (point-max)) > (if (eq status 'exit) > (cond ((zerop code) > '("finished (matches found)\n" . "matched")) Sounds like a good idea. The call to ansi-color-apply-on-region should probably be in the process filter so it's applied on-the-fly rather than at the end of the command, but that can be changed later on (I think it requires more changes). > The matching positions returned by grep could be also used instead of > `highlight-regexp' to highlight substrings in visited source lines. How can you get `grep' to return matching positions? Stefan