[Top][All Lists]

[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, 10 May 2005 13:36:43 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

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

> Could the code in font-lock-fontify-keywords-region use a marker to
> maintain that position?  Then it would be relocated automatically.

Would the patch below do the trick?


--- font-lock.el        05 mai 2005 16:09:23 -0400      1.245
+++ font-lock.el        10 mai 2005 13:35:07 -0400      
@@ -1405,6 +1405,7 @@
   (let ((case-fold-search font-lock-keywords-case-fold-search)
        (keywords (cddr font-lock-keywords))
        (bufname (buffer-name)) (count 0)
+        (pos (make-marker))
        keyword matcher highlights)
     ;; Fontify each item in `font-lock-keywords' from `start' to `end'.
@@ -1439,12 +1440,13 @@
        (while highlights
          (if (numberp (car (car highlights)))
              (font-lock-apply-highlight (car highlights))
-           (let ((pos (point)))
+           (set-marker pos (point))
              (font-lock-fontify-anchored-keywords (car highlights) end)
              ;; Ensure forward progress.
-             (if (< (point) pos) (goto-char pos))))
+            (if (< (point) pos) (goto-char pos)))
          (setq highlights (cdr highlights))))
-      (setq keywords (cdr keywords)))))
+      (setq keywords (cdr keywords)))
+    (set-marker pos nil)))
 ;;; End of Keyword regexp fontification functions.

reply via email to

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