unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@jurta.org>
Cc: emacs-devel@gnu.org
Subject: Re: Fwd: Re: junk in *grep* buffers
Date: Tue, 10 May 2005 00:16:43 +0300	[thread overview]
Message-ID: <873bswvyd0.fsf@jurta.org> (raw)
In-Reply-To: <E1DVFPC-0005O2-Ff@fencepost.gnu.org> (Richard Stallman's message of "Mon, 09 May 2005 17:03:10 -0400")

>     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	other threads:[~2005-05-09 21:16 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 [this message]
2005-05-10 16:26         ` Richard Stallman
2005-05-10 17:36           ` Stefan Monnier
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=873bswvyd0.fsf@jurta.org \
    --to=juri@jurta.org \
    --cc=emacs-devel@gnu.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).