From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: Re: Fwd: Re: junk in *grep* buffers Date: Tue, 10 May 2005 00:16:43 +0300 Organization: JURTA Message-ID: <873bswvyd0.fsf@jurta.org> References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1115680222 32212 80.91.229.2 (9 May 2005 23:10:22 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 9 May 2005 23:10:22 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue May 10 01:10:19 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DVHNc-0004bU-Fq for ged-emacs-devel@m.gmane.org; Tue, 10 May 2005 01:09:40 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DVHW2-000391-2Y for ged-emacs-devel@m.gmane.org; Mon, 09 May 2005 19:18:22 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DVHTv-0002rI-3J for emacs-devel@gnu.org; Mon, 09 May 2005 19:16:11 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DVHTr-0002py-KO for emacs-devel@gnu.org; Mon, 09 May 2005 19:16:07 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DVHTr-0002jx-AC for emacs-devel@gnu.org; Mon, 09 May 2005 19:16:07 -0400 Original-Received: from [199.232.41.67] (helo=mx20.gnu.org) by monty-python.gnu.org with esmtp (TLS-1.0:RSA_ARCFOUR_SHA:16) (Exim 4.34) id 1DVHW2-00059t-Tz; Mon, 09 May 2005 19:18:22 -0400 Original-Received: from [194.126.101.100] (helo=MXR-8.estpak.ee) by mx20.gnu.org with esmtp (Exim 4.34) id 1DVHNS-0002m8-Le; Mon, 09 May 2005 19:09:30 -0400 Original-Received: from mail.neti.ee (80-235-35-254-dsl.mus.estpak.ee [80.235.35.254]) by MXR-8.estpak.ee (Postfix) with ESMTP id CF69F5997C; Tue, 10 May 2005 02:09:20 +0300 (EEST) Original-To: rms@gnu.org In-Reply-To: (Richard Stallman's message of "Mon, 09 May 2005 17:03:10 -0400") User-Agent: Gnus/5.110002 (No Gnus v0.2) Emacs/22.0.50 (gnu/linux) 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:36919 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:36919 > This is still not enough when there are multiple matches on the same line > close to each other. Since we delete some text during fontification > font-lock-fontify-keywords-region will skip over some of the following > text when it readjusts point. > > Is it possible to adjust the position at which > font-lock-fontify-keywords-region will set point, to compensate for > the deletion? Could the code use a marker to maintain that position? > Then it would be relocated automatically. The following hack fixes the problem, but this is an imperfect solution. It sets the local variable `pos' from `font-lock-fontify-keywords-region' to avoid changing the current position on the line: ;; Ensure forward progress. (if (< (point) pos) (goto-char pos)) Index: lisp/progmodes/grep.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/progmodes/grep.el,v retrieving revision 1.36 diff -u -r1.36 grep.el --- lisp/progmodes/grep.el 7 May 2005 16:21:12 -0000 1.36 +++ lisp/progmodes/grep.el 9 May 2005 22:16:22 -0000 @@ -303,7 +303,8 @@ ;; Delete markers with `replace-match' because it updates ;; the match-data, whereas `delete-region' would render it obsolete. (replace-match "" t t nil 3) - (replace-match "" t t nil 1))))) + (replace-match "" t t nil 1) + (setq pos (point)))))) "Additional things to highlight in grep output. This gets tacked on the end of the generated expressions.") -- Juri Linkov http://www.jurta.org/emacs/