emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Highlighting in grep buffer


From: Stefan Monnier
Subject: Re: Highlighting in grep buffer
Date: 08 Apr 2004 12:38:42 -0400
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

>   (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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]