From: Tassilo Horn <tassilo@member.fsf.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 6808@debbugs.gnu.org
Subject: bug#6808: 24.0.50; Incomplete match highlighting with `query-replace-regexp'
Date: Fri, 6 Aug 2010 19:43:47 +0200 [thread overview]
Message-ID: <201008061943.47792.tassilo@member.fsf.org> (raw)
In-Reply-To: <jwvvd7nanpn.fsf-monnier+emacs@gnu.org>
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
next prev parent reply other threads:[~2010-08-06 17:43 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-06 6:46 bug#6808: 24.0.50; Incomplete match highlighting with `query-replace-regexp' Tassilo Horn
2010-08-06 13:13 ` Stefan Monnier
2010-08-06 17:43 ` Tassilo Horn [this message]
2010-08-07 0:01 ` Johan Bockgård
2010-08-08 20:56 ` Chong Yidong
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=201008061943.47792.tassilo@member.fsf.org \
--to=tassilo@member.fsf.org \
--cc=6808@debbugs.gnu.org \
--cc=monnier@iro.umontreal.ca \
/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).