From: Augusto Stoffel <arstoffel@gmail.com>
To: Jai Flack <jflack@disroot.org>
Cc: Philip Kaludercic <philipk@posteo.net>,
emacs-devel@gnu.org, Stefan Monnier <monnier@iro.umontreal.ca>,
Juri Linkov <juri@linkov.net>
Subject: Re: lazy-count-update-hook run with inconsistent point
Date: Fri, 25 Mar 2022 08:54:03 +0100 [thread overview]
Message-ID: <87bkxuqxgk.fsf@gmail.com> (raw)
In-Reply-To: <87k0cietbh.fsf_-_@disroot.org> (Jai Flack's message of "Fri, 25 Mar 2022 11:04:18 +1000")
[-- Attachment #1: Type: text/plain, Size: 956 bytes --]
Hi Jai,
On Fri, 25 Mar 2022 at 11:04, Jai Flack <jflack@disroot.org> 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?
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Always-run-isearch-lazy-count-update-hook-with-point.patch --]
[-- Type: text/x-patch, Size: 1297 bytes --]
From 6b656aa52dd539c519daab21ccef337366a9eb91 Mon Sep 17 00:00:00 2001
From: Augusto Stoffel <arstoffel@gmail.com>
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))))))
\f
;; Reading from minibuffer with lazy highlight and match count
--
2.35.1
next prev parent reply other threads:[~2022-03-25 7:54 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-23 11:56 [NonGNU] New package: ctrlf and Questions jflack
2022-02-23 18:33 ` Augusto Stoffel
2022-02-23 19:40 ` Philip Kaludercic
2022-02-23 20:59 ` Augusto Stoffel
2022-02-24 10:36 ` Jai Flack
2022-02-26 11:02 ` Augusto Stoffel
2022-02-27 4:02 ` Stefan Monnier
2022-03-16 11:37 ` Overlay count for isearch (Was: [NonGNU] New package: ctrlf and Questions) Jai Flack
2022-03-16 12:00 ` Overlay count for isearch Augusto Stoffel
2022-03-18 2:45 ` Jai Flack
2022-03-18 8:21 ` Philip Kaludercic
2022-03-24 1:22 ` Jai Flack
2022-03-24 8:31 ` Juri Linkov
2022-03-25 1:04 ` lazy-count-update-hook run with inconsistent point (Was: Overlay count for isearch) Jai Flack
2022-03-25 7:54 ` Augusto Stoffel [this message]
2022-03-25 8:36 ` lazy-count-update-hook run with inconsistent point Juri Linkov
2022-03-25 9:48 ` Augusto Stoffel
2022-03-27 5:24 ` Jai Flack
2022-03-27 7:48 ` Juri Linkov
2022-03-26 3:28 ` Overlay count for isearch Richard Stallman
2022-03-27 5:03 ` Jai Flack
2022-03-05 4:39 ` [NonGNU] New package: ctrlf and Questions Jai Flack
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87bkxuqxgk.fsf@gmail.com \
--to=arstoffel@gmail.com \
--cc=emacs-devel@gnu.org \
--cc=jflack@disroot.org \
--cc=juri@linkov.net \
--cc=monnier@iro.umontreal.ca \
--cc=philipk@posteo.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).