emacs-devel
[Top][All Lists]
Advanced

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

Re: Fwd: Re: junk in *grep* buffers


From: Stefan Monnier
Subject: Re: Fwd: Re: junk in *grep* buffers
Date: Tue, 26 Apr 2005 17:24:24 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (darwin)

> Would someone please investigate this bug?
> Please respond to this message if you investigate it.

I can't investigate it (no time, and no coloring-grep to try it on),
but here is a suggestion.

> When I do M-x grep and use

>   grep -nH -e "(define-minor-mode" lisp/*.el

> I get a *grep* buffer with occurrences of "(define-minor-mode" in lisp
> files.  Every time that I tried, most lines in this buffer give the
> text "(define-minor-mode" the grep-match-face, but a few lines don't
> fontify "(define-minor-mode".  The strange thing is that the lines
> that don't fontify "(define-minor-mode" are different every time I
> invoke grep.

The problem, most likely is the following:

1 - grep sends a partial line like

     foo:123:toto \033[01;41mMATCH\033[00m

2 - font-lock fontifies this, which adds a face property and removes
    the markers, so the text is now:

     foo:123:toto MATCH

3 - grep sends the rest of the line

     bar baz\n

    so the complete line is now

     foo:123:toto MATCH bar baz\n

4 - font-lock is triggered again to fontify the added text, but it works
    a line-at-a-time so it re-fontifies the whole line, what begins by
    removing the `face' property and never re-adds it since the merkers are
    now lost.

So the patch below should fix the problem because it uses the font-lock-face
property which is not cleared by font-lock.

If you find the patch works, please just install it for me,


        Stefan


Index: grep.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/progmodes/grep.el,v
retrieving revision 1.34
diff -u -u -b -r1.34 grep.el
--- grep.el     9 Feb 2005 15:50:36 -0000       1.34
+++ grep.el     26 Apr 2005 21:17:45 -0000
@@ -1,7 +1,7 @@
 ;;; grep.el --- run compiler as inferior of Emacs, parse error messages
 
 ;; Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-;;   2001, 2002, 2004  Free Software Foundation, Inc.
+;;   2001, 2002, 2004, 2005  Free Software Foundation, Inc.
 
 ;; Author: Roland McGrath <address@hidden>
 ;; Maintainer: FSF
@@ -294,7 +294,7 @@
       (2 compilation-line-face))
      ;; Highlight grep matches and delete markers
      ("\\(\033\\[01;41m\\)\\(.*?\\)\\(\033\\[00m\\(\033\\[K\\)?\\)"
-      (2 grep-match-face)
+      (2 (list 'face nil 'font-lock-face grep-match-face))
       ((lambda (p))
        (progn
         ;; Delete markers with `replace-match' because it updates




reply via email to

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