bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#10887: 24.0.93; lazy-highlighting in `query-replace' after a word-ty


From: Juri Linkov
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
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (x86_64-pc-linux-gnu)

> 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 ()






reply via email to

[Prev in Thread] Current Thread [Next in Thread]