emacs-devel
[Top][All Lists]
Advanced

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

Re: Highlighting in grep buffer


From: Juri Linkov
Subject: Re: Highlighting in grep buffer
Date: Thu, 08 Apr 2004 07:21:18 +0300
User-agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (gnu/linux)

Isn't something like this a simpler and more reliable solution?

*** emacs/lisp/progmodes/grep.el        11 Mar 2004 22:56:19 -0000      1.10
--- emacs/lisp/progmodes/grep.el        8 Apr 2004 00:37:46 -0000
***************
*** 281,288 ****
--- 281,291 ----
  (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"))

The matching positions returned by grep could be also used instead of
`highlight-regexp' to highlight substrings in visited source lines.

-- 
Juri Linkov
http://www.jurta.org/emacs/





reply via email to

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