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.devel Subject: Re: lazy-count-update-hook run with inconsistent point Date: Fri, 25 Mar 2022 10:36:37 +0200 Organization: LINKOV.NET Message-ID: <86wngimnbm.fsf@mail.linkov.net> References: <9631587bddf2ab3b07b60bd4195cc3e1@disroot.org> <87r17tmnzc.fsf@gmail.com> <8735k9jrr2.fsf@posteo.net> <87mtihmh8t.fsf@gmail.com> <87tucoblfh.fsf@disroot.org> <878rtxdh6a.fsf@gmail.com> <87czim3z8g.fsf_-_@disroot.org> <87zglqf6pp.fsf@gmail.com> <87r170t1vm.fsf@disroot.org> <871qyzpt6u.fsf@posteo.net> <87ee2s87qp.fsf@disroot.org> <86ee2reopn.fsf@mail.linkov.net> <87k0cietbh.fsf_-_@disroot.org> <87bkxuqxgk.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="3740"; 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: Jai Flack , Philip Kaludercic , Stefan Monnier , emacs-devel@gnu.org To: Augusto Stoffel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Mar 25 10:11:50 2022 Return-path: Envelope-to: ged-emacs-devel@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 1nXfz4-0000nF-Cj for ged-emacs-devel@m.gmane-mx.org; Fri, 25 Mar 2022 10:11:50 +0100 Original-Received: from localhost ([::1]:44086 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nXfz3-0006u4-8S for ged-emacs-devel@m.gmane-mx.org; Fri, 25 Mar 2022 05:11:49 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:41690) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nXfxb-0005vk-J8 for emacs-devel@gnu.org; Fri, 25 Mar 2022 05:10:20 -0400 Original-Received: from [2001:4b98:dc4:8::230] (port=51361 helo=relay10.mail.gandi.net) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nXfxZ-0001q5-Hn for emacs-devel@gnu.org; Fri, 25 Mar 2022 05:10:19 -0400 Original-Received: (Authenticated sender: juri@linkov.net) by mail.gandi.net (Postfix) with ESMTPSA id 57AB9240008; Fri, 25 Mar 2022 09:10:07 +0000 (UTC) In-Reply-To: <87bkxuqxgk.fsf@gmail.com> (Augusto Stoffel's message of "Fri, 25 Mar 2022 08:54:03 +0100") X-Host-Lookup-Failed: Reverse DNS lookup failed for 2001:4b98:dc4:8::230 (failed) Received-SPF: pass client-ip=2001:4b98:dc4:8::230; envelope-from=juri@linkov.net; helo=relay10.mail.gandi.net X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:287440 Archived-At: >> What do you think about lazy-count-update-hook being run with >> inconsistent point? It's called from three points in isearch.el and from >> best I can tell, for two of those (in isearch-lazy-highlight-new-loop) >> it is always called with point at the current match (start or end >> depending on forward or reverse search); however the last call (in >> isearch-lazy-highlight-buffer-update) is inside the save-excursion and >> so the point is wherever the last overlay has been created. > ... > Anyway, that was an oversight. Does the patch below solve the problem? > ... > @@ -4342,11 +4342,12 @@ isearch-lazy-highlight-buffer-update > (setq isearch-lazy-count-current > (gethash opoint isearch-lazy-count-hash 0)) > (when (and isearch-mode (null isearch-message-function)) > - (isearch-message)) > - (run-hooks 'lazy-count-update-hook)) > + (isearch-message))) > (setq isearch-lazy-highlight-timer > (run-at-time lazy-highlight-interval nil > - 'isearch-lazy-highlight-buffer-update))))))))) > + 'isearch-lazy-highlight-buffer-update))))) > + (when nomore > + (run-hooks 'lazy-count-update-hook)))))) Running the hook was also under another condition: `(when isearch-lazy-count ...)'. Shouldn't it be added to `(when nomore ...)' too?