GNU bug report logs -
#6808
24.0.50; Incomplete match highlighting with `query-replace-regexp'
Previous Next
Reported by: Tassilo Horn <tassilo <at> member.fsf.org>
Date: Fri, 6 Aug 2010 06:46:02 UTC
Severity: normal
Found in version 24.0.50
Done: Chong Yidong <cyd <at> stupidchicken.com>
Bug is archived. No further changes may be made.
Full log
Message #11 received at 6808 <at> debbugs.gnu.org (full text, mbox):
On Friday 06 August 2010 15:13:55 Stefan Monnier wrote:
> > The matches to be replaced by `query-replace-regexp' aren't highlighted
> > completely, although the replacement is correct.
>
> > Here's a recipe:
>
> > 1. emacs -Q
> > 2. Create a buffer with contents:
>
> > #1 153030 120 = 423988
> > #2 152845 181 = 1500234
> > #3 155160 247 = 767821
> > #4 155160 310 = 11131347
> > #5 155160 319 = 13979167
>
> > 3. M-x query-replace-regexp RET [0-9]+ = RET RET
>
> > Result:
>
> > - The first match "120 =" is highlighted completely.
> > - All further matches have only the last number highlighted, e.g. "1 =",
> > "7 =", ...
> > - Performing the replacement replaces the correct, complete match,
> > e.g. "120 =", "181 =", "247 ="
>
> I'd guess that those incorrect matches are search with
> re-search-backward rather than re-search-forward.
To check your guess, I adviced that subr:
(defadvice re-search-backward (before rsb-called activate)
(message "re-search-backward was called"))
Indeed, with that example above, for the 5 replacements that subr is
called 25 times.
I tried the same in an emacs without -Q, and although I had that
incorrect highlighting at first, after typing the advice and evaling it,
out of sudden it highlighted correctly...
Another thing that is a bit strange (but it doesn't qualify as a bug) is
that if you have point in the middle of the example, also matches before
point are highlighted, although you won't reach them.
Bye,
Tassilo
This bug report was last modified 14 years and 348 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.