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: Fri, 08 Apr 2022 10:32:41 +0300 Organization: LINKOV.NET Message-ID: <86fsmohwe6.fsf@mail.linkov.net> References: <87sftyweb2.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> <86r16fz6bw.fsf@mail.linkov.net> <87o81i5zzn.fsf@gmail.com> <86v8vo6c2k.fsf@mail.linkov.net> <87bkxfeb8j.fsf@gmail.com> <86wng3laj3.fsf@mail.linkov.net> <87r168g056.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="1996"; 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 Fri Apr 08 09:51:07 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 1ncjOc-0000Ob-Ik for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 08 Apr 2022 09:51:06 +0200 Original-Received: from localhost ([::1]:38152 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ncjOb-0002iq-2N for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 08 Apr 2022 03:51:05 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:47214) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ncjNy-0002gt-B3 for bug-gnu-emacs@gnu.org; Fri, 08 Apr 2022 03:50:26 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:39951) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ncjNZ-0001yM-QA for bug-gnu-emacs@gnu.org; Fri, 08 Apr 2022 03:50:26 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ncjNZ-000195-Lo for bug-gnu-emacs@gnu.org; Fri, 08 Apr 2022 03:50:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 08 Apr 2022 07:50:01 +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.16494041854375 (code B ref 53126); Fri, 08 Apr 2022 07:50:01 +0000 Original-Received: (at 53126) by debbugs.gnu.org; 8 Apr 2022 07:49:45 +0000 Original-Received: from localhost ([127.0.0.1]:33848 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ncjNI-00018V-SN for submit@debbugs.gnu.org; Fri, 08 Apr 2022 03:49:45 -0400 Original-Received: from relay11.mail.gandi.net ([217.70.178.231]:44637) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ncjNH-00018I-6S for 53126@debbugs.gnu.org; Fri, 08 Apr 2022 03:49:43 -0400 Original-Received: (Authenticated sender: juri@linkov.net) by mail.gandi.net (Postfix) with ESMTPSA id 28C67100017; Fri, 8 Apr 2022 07:49:35 +0000 (UTC) In-Reply-To: <87r168g056.fsf@gmail.com> (Augusto Stoffel's message of "Thu, 07 Apr 2022 21:32:21 +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:229554 Archived-At: >> Looks good. > > Okay, I've refactored my code like this. I actually like it better that > way. (As a downside, the stuff that was already merged to isearch.el is > completely changed.) Thanks, now it looks much better! In `isearch-edit-string' you replaced: (add-hook 'minibuffer-setup-hook #'minibuffer-lazy-highlight-setup) with (minibuffer-with-setup-hook (minibuffer-lazy-highlight-setup) but the docstring of `minibuffer-lazy-highlight-setup' in your patch is: This function return a closure intended to be added to `minibuffer-setup-hook'. Maybe either a typo that needs to mention `minibuffer-with-setup-hook', or `minibuffer-setup-hook' needs to evaluate such closure with something like (add-hook 'minibuffer-setup-hook (funcall 'minibuffer-lazy-highlight-setup)) But since this is more ugly, then using `minibuffer-with-setup-hook' is fine. >> Shouldn't both cases clean up highlight from the buffer? >> Then I see no need to distinguish each case. Or if really needed, >> you can try to bind the cleanup to command-error-function. > > My previous patch had only one case: if the user quits, we clean up the > highlighting. > > I can only see one simpler alternative, which is to always > unconditionally clean up the highlight. This is not as nice, but if > keeping the code as simple as possible is important here, then I guess > this is the way forward. So that's what the current patch does. > > I suspect people will see this as a bug, but maybe discussing this issue > by itself later will be easier. Yep, let's do this later when people will ask for it. >> 4 lines look nice, unlike 20 lines in one of your patches ;-) > > When you add all the bells and whistles, 4 lines just won't do it. Now the parameters of minibuffer-lazy-highlight-setup look nice, so line count doesn't matter when code keeps simplicity.