[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#6808: 24.0.50; Incomplete match highlighting with `query-replace-reg
From: |
Tassilo Horn |
Subject: |
bug#6808: 24.0.50; Incomplete match highlighting with `query-replace-regexp' |
Date: |
Fri, 6 Aug 2010 19:43:47 +0200 |
User-agent: |
KMail/1.13.5 (Linux/2.6.35-gentoo; KDE/4.4.5; x86_64; ; ) |
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