From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Fwd: Re: junk in *grep* buffers Date: Tue, 26 Apr 2005 17:24:24 -0400 Message-ID: References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1114553125 10541 80.91.229.2 (26 Apr 2005 22:05:25 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 26 Apr 2005 22:05:25 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Apr 27 00:05:20 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DQYAa-0000KF-RM for ged-emacs-devel@m.gmane.org; Wed, 27 Apr 2005 00:04:41 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DQYGO-0007HR-Bu for ged-emacs-devel@m.gmane.org; Tue, 26 Apr 2005 18:10:40 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DQY8i-0002mZ-21 for emacs-devel@gnu.org; Tue, 26 Apr 2005 18:02:44 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DQY8f-0002lI-3X for emacs-devel@gnu.org; Tue, 26 Apr 2005 18:02:43 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DQY8e-0006rm-Mm for emacs-devel@gnu.org; Tue, 26 Apr 2005 18:02:40 -0400 Original-Received: from [206.47.199.166] (helo=simmts8-srv.bellnexxia.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1DQXbN-0001T0-53; Tue, 26 Apr 2005 17:28:17 -0400 Original-Received: from empanada.home ([65.92.240.194]) by simmts8-srv.bellnexxia.net (InterMail vM.5.01.06.10 201-253-122-130-110-20040306) with ESMTP id <20050426212425.YFMN1623.simmts8-srv.bellnexxia.net@empanada.home>; Tue, 26 Apr 2005 17:24:25 -0400 Original-Received: by empanada.home (Postfix, from userid 502) id 37C5052FD7C; Tue, 26 Apr 2005 17:24:25 -0400 (EDT) Original-To: rms@gnu.org, Lute Kamstra In-Reply-To: (Richard Stallman's message of "Tue, 26 Apr 2005 06:06:02 -0400") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (darwin) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:36425 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:36425 > 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 ;; 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