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: Juri Linkov
Subject: Re: Fwd: Re: junk in *grep* buffers
Date: Tue, 10 May 2005 00:16:43 +0300
User-agent: Gnus/5.110002 (No Gnus v0.2) Emacs/22.0.50 (gnu/linux)

>     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/





reply via email to

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