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: Sun, 09 Jan 2022 11:10:13 +0200 Organization: LINKOV.NET Message-ID: <86k0f9xnrn.fsf@mail.linkov.net> References: <87sftyweb2.fsf@gmail.com> <861r1iyrvw.fsf@mail.linkov.net> <87zgo6owaf.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="21048"; 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 Sun Jan 09 10:44:24 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 1n6UkS-0005MJ-GF for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 09 Jan 2022 10:44:24 +0100 Original-Received: from localhost ([::1]:54038 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n6UkR-0000fu-4Y for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 09 Jan 2022 04:44:23 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:54662) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n6UWl-0001CD-9Y for bug-gnu-emacs@gnu.org; Sun, 09 Jan 2022 04:30:17 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:56292) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n6UWY-0006ez-J4 for bug-gnu-emacs@gnu.org; Sun, 09 Jan 2022 04:30:14 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1n6UWY-0007We-8W for bug-gnu-emacs@gnu.org; Sun, 09 Jan 2022 04:30:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 09 Jan 2022 09:30: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.164172054928844 (code B ref 53126); Sun, 09 Jan 2022 09:30:02 +0000 Original-Received: (at 53126) by debbugs.gnu.org; 9 Jan 2022 09:29:09 +0000 Original-Received: from localhost ([127.0.0.1]:49195 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n6UVh-0007V9-Ec for submit@debbugs.gnu.org; Sun, 09 Jan 2022 04:29:09 -0500 Original-Received: from relay8-d.mail.gandi.net ([217.70.183.201]:54913) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n6UVf-0007Ul-Qy for 53126@debbugs.gnu.org; Sun, 09 Jan 2022 04:29:08 -0500 Original-Received: (Authenticated sender: juri@linkov.net) by relay8-d.mail.gandi.net (Postfix) with ESMTPSA id 7864E1BF207; Sun, 9 Jan 2022 09:28:59 +0000 (UTC) In-Reply-To: <87zgo6owaf.fsf@gmail.com> (Augusto Stoffel's message of "Sat, 08 Jan 2022 20:35:36 +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:223835 Archived-At: >> Strange, I expected that the lazy-count feature applied to query-replace >> should do a different thing - when querying about replacing the current match, >> it should show the number of current match and the number of total matches. >> The latter number should be updated after every replacement. > > That would be handy too. I haven't checked how the `perform-replace' > loop works, but wouldn't this require a hook into the lazy count > procedure --- precisely what my patch introduces through the new > variable `isearch-lazy-count-display-function'? It seems the "Query replacing" prompt in perform-replace could just display the values of isearch-lazy-count-current and isearch-lazy-count-total. Or for asynchronous lazy-count a new hook needs to be run at the end of isearch-lazy-highlight-buffer-update in addition to the call of isearch-message. >> But your patches are intended for a different feature - highlighting >> of matches in the buffer while entering an input string in the minibuffer. >> >> I wonder how many users need this feature, when it's easy to construct >> a query-replace string using highlighting/counting in isearch-mode, >> then type M-% >> (isearch-query-replace) that invokes query-replace with the >> query-replace string. > > Sure, this alternative method works. But somehow it's not the way I > usually start a replace, and I think there's nothing wrong with that > preference :-) But this method is more limiting - no keys to pull text from the buffer like 'C-w' (isearch-yank-word-or-char) does in isearch-mode, no way to navigate to the first match like it's possible in isearch-mode, etc. >> Perhaps better to ask on emacs-devel if anyone needs this feature. > > We can ask. But note that the bulk of the patch has a fairly general > purpose, namely to read a regexp with live preview of the matches. > There's probably a couple extra uses for this. Maybe then this feature could be added to read-regexp or even to read-from-minibuffer? And activated by adding a setup function to minibuffer-setup-hook like other minibuffer's features do, such as icomplete-minibuffer-setup, minibuffer-depth-setup, rfn-eshadow-setup-minibuffer. Then maybe a new feature could be named e.g. "lazy-minibuffer"?