From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Augusto Stoffel Newsgroups: gmane.emacs.devel Subject: Re: lazy-count-update-hook run with inconsistent point Date: Fri, 25 Mar 2022 08:54:03 +0100 Message-ID: <87bkxuqxgk.fsf@gmail.com> 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> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2207"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.92 (gnu/linux) Cc: Philip Kaludercic , emacs-devel@gnu.org, Stefan Monnier , Juri Linkov To: Jai Flack Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Mar 25 08:56:04 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 1nXenj-0000KT-Ar for ged-emacs-devel@m.gmane-mx.org; Fri, 25 Mar 2022 08:56:03 +0100 Original-Received: from localhost ([::1]:38556 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nXenh-0005MG-SA for ged-emacs-devel@m.gmane-mx.org; Fri, 25 Mar 2022 03:56:01 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:56158) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nXels-0004dk-JV for emacs-devel@gnu.org; Fri, 25 Mar 2022 03:54:10 -0400 Original-Received: from [2a00:1450:4864:20::634] (port=46014 helo=mail-ej1-x634.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nXelr-0007CX-3F for emacs-devel@gnu.org; Fri, 25 Mar 2022 03:54:08 -0400 Original-Received: by mail-ej1-x634.google.com with SMTP id qa43so13683985ejc.12 for ; Fri, 25 Mar 2022 00:54:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=AB4Q/qTRMGCdBQFOCiWyM+BjiYFM9droDsh4xnnJZRI=; b=kSHqlDntJU80/GPsooM72b2PuIUOa8HkTZKQ6tMPs6qyW+Gw76B78tOd3Wp16Dq3Gz 3hYtI0TvZdRiSGbK67rU4Ysn7GgZj4U7LgX620eDakTRPQ0hhV5oSi9l/u7Ah8vb5XI2 plYmErfZDvxPts05uS2e9tbD/II0zBcwL1i9J5Jkb104UQh/kW/LIQ6Ngd2CzG9has00 IXtaRIBLO/4FSa5uycNqntWPWCM+FAFoNIKt2uWkwt+rz3h1HwlbFQRL8qLMYXA7+t+Z XS6OHVgpIT15utS7TypeTVXMT1o8HurycGm2Vj5t8sJiLcZ3Hz4EIeKGPh4TqpS8lbfT l5fw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=AB4Q/qTRMGCdBQFOCiWyM+BjiYFM9droDsh4xnnJZRI=; b=Eg0quGhPQsQtyiTPM6OnwKdreIT4t/cFdufyS3OhvhPATx7mjRdajTZ/U8GUS4l14Y w8iKDO1xpOHJok8EifQJT3uejEnQeQwNW8gwZl3TrWf5UVc71oz+AYz8WK9lqkKWQCXO DPPXOB+kwUH0ZRzJ2xGIFvnxBH0RbaZQaKr3b6KXf9l7q/rwrPMVDenisk60JNGd9n/F bfk3yjNEVdMoIvEZf5PVnsAtkerlIBPzriGIFVVRUiR7poJLzd6zv74+YgsJnzt7j790 B8xonWwDbpUe1QB/+DIqh98ejxVx2lPUK8dPxH56RgrHdoqheR2cu2YXG565CTNp2jro CYNA== X-Gm-Message-State: AOAM531c0McwJDVXU6NF1Cev+GAwt8Y7UK/xidtQE7GW+mDdPQv751/J T77Fhogzr5Jsg39U5SHe9MhFd5R0s+g= X-Google-Smtp-Source: ABdhPJxtrRROMVISDw3by952QAnOdqW4JaFy18f+fQcX9is0N6x/5RVSjN2sIEBk0kwn1VO7ey1pFA== X-Received: by 2002:a17:907:2d06:b0:6e0:2ec:c7bd with SMTP id gs6-20020a1709072d0600b006e002ecc7bdmr10569987ejc.656.1648194845250; Fri, 25 Mar 2022 00:54:05 -0700 (PDT) Original-Received: from ars3 ([2a02:8109:8ac0:56d0::7039]) by smtp.gmail.com with ESMTPSA id b8-20020a056402350800b00419407f0dd9sm2430860edd.0.2022.03.25.00.54.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Mar 2022 00:54:04 -0700 (PDT) In-Reply-To: <87k0cietbh.fsf_-_@disroot.org> (Jai Flack's message of "Fri, 25 Mar 2022 11:04:18 +1000") X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::634 (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::634; envelope-from=arstoffel@gmail.com; helo=mail-ej1-x634.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, 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:287438 Archived-At: --=-=-= Content-Type: text/plain Hi Jai, On Fri, 25 Mar 2022 at 11:04, Jai Flack wrote: > 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. > > I can't see any reason for this inconsistency in the UI updating code > (starting line 4338 on 392d66f6f5) so should this be moved outside the > save-excursion or rather documented as unreliable? It should be reliable. > Note: my package can use isearch-match-data so this is just a minor > implementation detail. Anyway, that was an oversight. Does the patch below solve the problem? --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Always-run-isearch-lazy-count-update-hook-with-point.patch >From 6b656aa52dd539c519daab21ccef337366a9eb91 Mon Sep 17 00:00:00 2001 From: Augusto Stoffel Date: Fri, 25 Mar 2022 08:46:57 +0100 Subject: [PATCH] Always run 'isearch-lazy-count-update-hook' with point at match * lisp/isearch.el (isearch-lazy-highlight-buffer-update): Run 'isearch-lazy-count-update-hook' outside of save-excursion, so point is at the current match. --- lisp/isearch.el | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lisp/isearch.el b/lisp/isearch.el index 9b311cb49e..6cee39c70a 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el @@ -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)))))) ;; Reading from minibuffer with lazy highlight and match count -- 2.35.1 --=-=-=--