unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Juri Linkov <juri@jurta.org>, emacs-devel@gnu.org
Subject: Re: Fwd: Re: junk in *grep* buffers
Date: Tue, 10 May 2005 13:36:43 -0400	[thread overview]
Message-ID: <jwvzmv3asrt.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <E1DVXYX-00075y-5Q@fencepost.gnu.org> (Richard Stallman's message of "Tue, 10 May 2005 12:26:01 -0400")

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


        Stefan


--- 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.
 \f

  reply	other threads:[~2005-05-10 17:36 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 ` Fwd: Re: junk in *grep* buffers Stefan Monnier
2005-04-27 11:29   ` 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 [this message]
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=jwvzmv3asrt.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    --cc=juri@jurta.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).