GNU bug report logs - #10887
24.0.93; lazy-highlighting in `query-replace' after a word-type Isearch

Previous Next

Package: emacs;

Reported by: Dani Moncayo <dmoncayo <at> gmail.com>

Date: Sun, 26 Feb 2012 10:07:02 UTC

Severity: normal

Found in version 24.0.93

Done: Juri Linkov <juri <at> jurta.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Juri Linkov <juri <at> jurta.org>
To: Dani Moncayo <dmoncayo <at> gmail.com>
Cc: 10887 <at> 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
> 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 ()





This bug report was last modified 12 years and 263 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.