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: 06 May 2004 10:39:02 -0400
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

> I was thinking about the best solution and it seems that using
> font-lock machinery for fontification of grep matches is the simplest
> and most consistent with principles which compile.el is based on:
> a new rule is added to `grep-mode-font-lock-keywords' which fontifies
> the text inside the grep markers and deletes them afterwards.

Agreed, but your current code will fail to re-highlight the matches if the
buffer is refontified.
We should either keep the markers (and make them invisible) or at least
place the face on the `font-lock-face' property rather than on the
`face' property (I'm not sure if this second method works "by design"
or "by accident", tho).

> I also made changes in `compilation-goto-locus' to highlight the
> matching string in the source buffer.  The variable `highlight-regexp'
> is set to a string found in `compilation-locus' face.  But perhaps
> this is not the best way to achieve the goal.

Seems pretty ugly indeed.

> Could someone familiar with compile.el suggest a better method, for
> example, something like setting the `message' property with calculated
> `col' and `end-col' on grep markers in `grep-mode-font-lock-keywords' and
> using them in `compilation-goto-locus'?

I'd rather keep this for a future version of Emacs.


        Stefan




reply via email to

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