From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#53126: 29.0.50; [PATCH] Lazy highlight/count when reading query-replace string, etc. Date: Thu, 17 Mar 2022 19:05:34 +0200 Organization: LINKOV.NET Message-ID: <86ilsc7e31.fsf@mail.linkov.net> References: <87sftyweb2.fsf@gmail.com> <861r1iyrvw.fsf@mail.linkov.net> <87zgo6owaf.fsf@gmail.com> <86k0f9xnrn.fsf@mail.linkov.net> <87tuedp6pl.fsf@gmail.com> <861r1g7n3b.fsf@mail.linkov.net> <87o84jcx5x.fsf@gmail.com> <8635lvif0r.fsf@mail.linkov.net> <87mtidip1w.fsf@gmail.com> <86sfrjia5u.fsf@mail.linkov.net> <87ilseyks7.fsf@gmail.com> <868rt9wwji.fsf@mail.linkov.net> <871qz11w82.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17499"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu) Cc: 53126@debbugs.gnu.org To: Augusto Stoffel Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Mar 17 18:11:39 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nUtf0-0004PW-LM for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 17 Mar 2022 18:11:38 +0100 Original-Received: from localhost ([::1]:46344 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nUtez-0000NK-HG for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 17 Mar 2022 13:11:37 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:43034) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nUteR-0008J3-5h for bug-gnu-emacs@gnu.org; Thu, 17 Mar 2022 13:11:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:32936) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nUteQ-0002tC-Ry for bug-gnu-emacs@gnu.org; Thu, 17 Mar 2022 13:11:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nUteQ-0008DD-Ew for bug-gnu-emacs@gnu.org; Thu, 17 Mar 2022 13:11:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 17 Mar 2022 17:11:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 53126 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 53126-submit@debbugs.gnu.org id=B53126.164753703031519 (code B ref 53126); Thu, 17 Mar 2022 17:11:02 +0000 Original-Received: (at 53126) by debbugs.gnu.org; 17 Mar 2022 17:10:30 +0000 Original-Received: from localhost ([127.0.0.1]:55064 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nUtdt-0008CG-Pz for submit@debbugs.gnu.org; Thu, 17 Mar 2022 13:10:30 -0400 Original-Received: from relay6-d.mail.gandi.net ([217.70.183.198]:60349) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nUtds-0008C0-Fm for 53126@debbugs.gnu.org; Thu, 17 Mar 2022 13:10:29 -0400 Original-Received: (Authenticated sender: juri@linkov.net) by mail.gandi.net (Postfix) with ESMTPSA id D5CDEC0006; Thu, 17 Mar 2022 17:10:19 +0000 (UTC) In-Reply-To: <871qz11w82.fsf@gmail.com> (Augusto Stoffel's message of "Wed, 16 Mar 2022 21:25:01 +0100") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:228496 Archived-At: >> When I tried your latest patch, it still flashes when it starts >> the perform-replace loop. > > Does it always happen for you? I see this occasionally, and as far as I > can tell it's random. It happens every time when starting perform-replace from isearch. >>>> Highlighting is still incorrect for word replacement ('C-u M-%') >>>> and for non-nil 'replace-char-fold'. To handle these cases correctly, >>>> 'replace-highlight' uses: >>>> >>>> (isearch-regexp-function (or replace-regexp-function >>>> delimited-flag >>>> (and replace-char-fold >>>> (not regexp-flag) >>>> #'char-fold-to-regexp))) >>> >>> Okay, fixed this. (BTW, where is replace-regexp-function used? It's >>> not set anywhere in Emacs, and it's not a defcustom either.) >> >> 'replace-regexp-function' was added recently in bug#52558 >> to allow implementing more regexp types in bug#54017. > > Ah, I see. I must say, in isearch.el I don't like this trichotomy of > the regexp/literal/with isearch-regexp-function cases. Ideally, the > regexp and literal search cases would be handled by > isearch-regexp-function set to identity respectively regexp-quote. But > it would be a large refactoring, perhaps with only aesthetic benefits. Yep, too much changes for little benefit. The biggest hunk in your patch are changes in query-replace-read-args starting from 'condition-case error'. Would it be possible to simplify this part? Maybe by some refactoring? OTOH, your changes that add lazy-count-update-hook and remove '(null isearch-message-function)' can be already pushed. Could you please send a separate patch for pushing with these changes only? Then the patch with minibuffer-lazy-count feature will be shorter.