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: Sat, 02 Apr 2022 21:23:10 +0300 Organization: LINKOV.NET Message-ID: <86r16fz6bw.fsf@mail.linkov.net> References: <87sftyweb2.fsf@gmail.com> <861r1g7n3b.fsf@mail.linkov.net> <87o84jcx5x.fsf@gmail.com> <8635lvif0r.fsf@mail.linkov.net> <87mtidip1w.fsf@gmail.com> <86zglrl4gq.fsf@mail.linkov.net> <87ee32yk7v.fsf@gmail.com> <861qz1zqfb.fsf@mail.linkov.net> <875yod1wyb.fsf@gmail.com> <86mtho5y56.fsf@mail.linkov.net> <87sfrgz979.fsf@gmail.com> <861qz0475w.fsf@mail.linkov.net> <87sfrd2cbb.fsf@gmail.com> <86fsnc4fvm.fsf@mail.linkov.net> <878rsz6um2.fsf@gmail.com> <86ils2mmbe.fsf@mail.linkov.net> <87v8w2qsee.fsf@gmail.com> <86y20vu9c6.fsf@mail.linkov.net> <875ynt41g9.fsf@gmail.com> <86pmm1azkd.fsf@mail.linkov.net> <87a6d43c6n.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="5799"; 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 Sat Apr 02 20:32:29 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 1naiY0-0001MX-Vf for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 02 Apr 2022 20:32:28 +0200 Original-Received: from localhost ([::1]:49472 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1naiXz-000454-Nw for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 02 Apr 2022 14:32:27 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:34066) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1naiXa-00044X-Jb for bug-gnu-emacs@gnu.org; Sat, 02 Apr 2022 14:32:05 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:52958) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1naiXa-0005oj-AF for bug-gnu-emacs@gnu.org; Sat, 02 Apr 2022 14:32:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1naiXa-0004hX-7Z for bug-gnu-emacs@gnu.org; Sat, 02 Apr 2022 14:32: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: Sat, 02 Apr 2022 18:32: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.164892428818031 (code B ref 53126); Sat, 02 Apr 2022 18:32:02 +0000 Original-Received: (at 53126) by debbugs.gnu.org; 2 Apr 2022 18:31:28 +0000 Original-Received: from localhost ([127.0.0.1]:46855 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1naiX2-0004gk-5R for submit@debbugs.gnu.org; Sat, 02 Apr 2022 14:31:28 -0400 Original-Received: from relay3-d.mail.gandi.net ([217.70.183.195]:43817) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1naiWz-0004gU-Q2 for 53126@debbugs.gnu.org; Sat, 02 Apr 2022 14:31:26 -0400 Original-Received: (Authenticated sender: juri@linkov.net) by mail.gandi.net (Postfix) with ESMTPSA id ADF9F60004; Sat, 2 Apr 2022 18:31:17 +0000 (UTC) In-Reply-To: <87a6d43c6n.fsf@gmail.com> (Augusto Stoffel's message of "Fri, 01 Apr 2022 20:12:32 +0200") 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:229301 Archived-At: >> Why do you think query-replace is more complex than other minibuffer commands? >> Other minibuffer commands need to set all the same a dozen of variables that >> control lazy highlighting. Otherwise, they will highlight some random matches >> that happen to reuse values left from a previous isearch. > > Without having tested, the lazy highlight feature for occur would only > require the addition of 4 lines: I could test it, but I'm quite sure 4 lines would not be sufficient, because lazy-highlight relies on much more isearch variables. > So yes, I'd say query-replace is very likely to be most complex case > there will be. And it has several unique features that make it quite > different from other potential uses of lazy highlight: > > - The splitting of the TO and FROM strings at "->". Agreed. > - The value of case-fold-search can change on the fly Please clarify when it can be changed on the fly. > - We must clean up the highlight only if the user quits, to avoid > flickering at the beginning of the perform-replace stage. I don't know how important is to avoid flickering at the beginning, when it flickers after every replacement anyway. > Okay, as I write this I realize occur would require some special stuff > if the region is active. This indeed should be factored out. But > hopefully you will agree with the 3 points above :-). I agreed on 1.5 points :-) >>> Right, a preview of the replacement text will also need some extra work. >>> This will probably involve some extension to >>> 'isearch-lazy-highlight-update', making it even more complicated... >> >> Why? Shouldn't it just highlight the same way the text >> entered into the minibuffer that reads the replacement? > > I'm referring to the anzu feature whereby the replacement text is shown > next to each match, like this: > > This will not be totally trivial to implement, right? And it will add > some extra stuff to query-replace-read-args that is very much > query-replace specific. I very much doubt in usefulness of such a feature. I thought it could simply highlight the replacement text to show the places in the buffer that already contain such replacement text.