unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@jurta.org>
Cc: rms@gnu.org, drew.adams@oracle.com, emacs-devel@gnu.org
Subject: Re: Highlighting in grep buffer
Date: Sun, 11 Apr 2004 01:29:12 +0300	[thread overview]
Message-ID: <87isg7cmcy.fsf@mail.jurta.org> (raw)
In-Reply-To: 87isgafmte.fsf-monnier+emacs@alfajor.local

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

Yes, calling the ansi-color-apply-on-region would be better from the
process filter, but there is a danger that boundaries of strings that
a process gives to the filter function will be inside an ANSI escape
sequence, which will screw up its fontification.

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

Matching positions are explicitly marked by ANSI escape sequences, so
these positions can be found before translating ANSI escape sequences
into faces.

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

  reply	other threads:[~2004-04-10 22:29 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-05 22:03 Highlighting in grep buffer Richard Stallman
2004-04-05 23:05 ` Drew Adams
2004-04-07 17:45   ` Richard Stallman
2004-04-07 18:16     ` Drew Adams
2004-04-08  4:21       ` Juri Linkov
2004-04-08 16:38         ` Stefan Monnier
2004-04-10 22:29           ` Juri Linkov [this message]
2004-04-11 23:20             ` Stefan Monnier
2004-05-06  8:55               ` Juri Linkov
2004-05-06 14:39                 ` Stefan Monnier
2004-05-06 21:03                   ` Miles Bader
2004-05-08 21:46                   ` Juri Linkov
2004-04-09 22:46         ` Richard Stallman
2004-04-10 22:28           ` Juri Linkov
2004-04-12  3:52             ` Richard Stallman
2004-04-12  4:32               ` Miles Bader
     [not found] <DNEMKBNJBGPAOPIJOOICMEGCCAAA.drew.adams@oracle.com>
2004-04-13 11:45 ` Juri Linkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87isg7cmcy.fsf@mail.jurta.org \
    --to=juri@jurta.org \
    --cc=drew.adams@oracle.com \
    --cc=emacs-devel@gnu.org \
    --cc=rms@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).