From: Juri Linkov <juri@jurta.org>
To: Dani Moncayo <dmoncayo@gmail.com>
Cc: 10887@debbugs.gnu.org
Subject: bug#10887: 24.0.93; lazy-highlighting in `query-replace' after a word-type Isearch
Date: Mon, 27 Feb 2012 12:57:27 +0200 [thread overview]
Message-ID: <87d3904ibw.fsf@mail.jurta.org> (raw)
In-Reply-To: <CAH8Pv0iPNhjsgO2vWXpM3yrYUWe12MdFKs45PZQ66Wby4VObCg@mail.gmail.com> (Dani Moncayo's message of "Sun, 26 Feb 2012 11:03:35 +0100")
> Recipe from "emacs -Q":
> 1. aa bb RET RET aa RET bb RET
> 2. C-s M-s w aa bb RET
> 3. M-<
> 4. M-% aa bb RET xx RET
>
> I observe that the "aa<RET>bb" part is lazy-highlighted, but obviously
> it should not be, because the query-replace will never get there (it's
> doing a normal search, not a word-type one).
Thanks for the report. For 24.1 it could be fixed with the patch below.
(In 24.2 for the true "word-replace" `replace-highlight' may need a new
argument `word' that will use isearch word mode for lazy-highlighting.)
=== modified file 'lisp/replace.el'
--- lisp/replace.el 2012-02-24 22:46:57 +0000
+++ lisp/replace.el 2012-02-27 10:54:20 +0000
@@ -2117,13 +2114,13 @@ (defun replace-highlight (match-beg matc
(if query-replace-lazy-highlight
(let ((isearch-string string)
(isearch-regexp regexp)
+ ;; Set isearch-word to nil because word-replace is regexp-based,
+ ;; so `isearch-search-fun' should not use `word-search-forward'.
+ (isearch-word nil)
(search-whitespace-regexp nil)
(isearch-case-fold-search case-fold)
(isearch-forward t)
(isearch-error nil))
- ;; Set isearch-word to nil because word-replace is regexp-based,
- ;; so `isearch-search-fun' should not use `word-search-forward'.
- (if (and isearch-word isearch-regexp) (setq isearch-word nil))
(isearch-lazy-highlight-new-loop range-beg range-end))))
(defun replace-dehighlight ()
next prev parent reply other threads:[~2012-02-27 10:57 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-26 10:03 bug#10887: 24.0.93; lazy-highlighting in `query-replace' after a word-type Isearch Dani Moncayo
2012-02-27 10:57 ` Juri Linkov [this message]
2012-02-27 13:22 ` Dani Moncayo
2012-03-11 10:29 ` Juri Linkov
2012-09-06 8:54 ` Juri Linkov
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=87d3904ibw.fsf@mail.jurta.org \
--to=juri@jurta.org \
--cc=10887@debbugs.gnu.org \
--cc=dmoncayo@gmail.com \
/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).