unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: Fwd: Re: junk in *grep* buffers
Date: Tue, 26 Apr 2005 17:24:24 -0400	[thread overview]
Message-ID: <m14qdtfdlm.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <E1DQMx8-0001wg-Jc@fencepost.gnu.org> (Richard Stallman's message of "Tue, 26 Apr 2005 06:06:02 -0400")

> 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 <roland@gnu.org>
 ;; 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	other threads:[~2005-04-26 21:24 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-26 10:06 [Lute.Kamstra.lists@xs4all.nl: Re: junk in *grep* buffers] Richard Stallman
2005-04-26 21:24 ` Stefan Monnier [this message]
2005-04-27 11:29   ` Fwd: Re: junk in *grep* buffers Lute Kamstra
2005-04-28 11:00   ` Richard Stallman
2005-05-08 13:44   ` Andreas Schwab
2005-05-09 21:03     ` Richard Stallman
2005-05-09 21:16       ` Juri Linkov
2005-05-10 16:26         ` Richard Stallman
2005-05-10 17:36           ` Stefan Monnier
2005-05-11  8:23             ` Juri Linkov
2005-05-10 12:33 ` [Lute.Kamstra.lists@xs4all.nl: Re: junk in *grep* buffers] Kai Großjohann

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=m14qdtfdlm.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@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).