From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs 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 Organization: JURTA Message-ID: <87d3904ibw.fsf@mail.jurta.org> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1330343189 26077 80.91.229.3 (27 Feb 2012 11:46:29 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 27 Feb 2012 11:46:29 +0000 (UTC) Cc: 10887@debbugs.gnu.org To: Dani Moncayo Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Feb 27 12:46:26 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1S1z2A-0000mx-3T for geb-bug-gnu-emacs@m.gmane.org; Mon, 27 Feb 2012 12:46:26 +0100 Original-Received: from localhost ([::1]:44806 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S1z29-0001MR-DT for geb-bug-gnu-emacs@m.gmane.org; Mon, 27 Feb 2012 06:46:25 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:45792) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S1z21-0001MG-JQ for bug-gnu-emacs@gnu.org; Mon, 27 Feb 2012 06:46:23 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S1z1w-0003Fx-E7 for bug-gnu-emacs@gnu.org; Mon, 27 Feb 2012 06:46:17 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:57240) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S1z1w-0003Fq-AK for bug-gnu-emacs@gnu.org; Mon, 27 Feb 2012 06:46:12 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1S1z4g-0001m1-Cg for bug-gnu-emacs@gnu.org; Mon, 27 Feb 2012 06:49:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 27 Feb 2012 11:49:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 10887 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 10887-submit@debbugs.gnu.org id=B10887.13303432876741 (code B ref 10887); Mon, 27 Feb 2012 11:49:02 +0000 Original-Received: (at 10887) by debbugs.gnu.org; 27 Feb 2012 11:48:07 +0000 Original-Received: from localhost ([127.0.0.1]:59134 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S1z3l-0001kd-Nj for submit@debbugs.gnu.org; Mon, 27 Feb 2012 06:48:06 -0500 Original-Received: from ps18281.dreamhost.com ([69.163.218.105]:53376 helo=ps18281.dreamhostps.com) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S1z3g-0001k7-Ov for 10887@debbugs.gnu.org; Mon, 27 Feb 2012 06:48:02 -0500 Original-Received: from localhost (ps18281.dreamhostps.com [69.163.218.105]) by ps18281.dreamhostps.com (Postfix) with ESMTP id 87CBA451C0B6; Mon, 27 Feb 2012 03:43:29 -0800 (PST) In-Reply-To: (Dani Moncayo's message of "Sun, 26 Feb 2012 11:03:35 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (x86_64-pc-linux-gnu) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:57294 Archived-At: > 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 "aabb" 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 ()