* bug#33838: 27.0.50; lazy-highlight fails with a quick key sequence
@ 2018-12-23 0:05 Juri Linkov
2018-12-23 23:27 ` Juri Linkov
0 siblings, 1 reply; 3+ messages in thread
From: Juri Linkov @ 2018-12-23 0:05 UTC (permalink / raw)
To: 33838
Quickly typing `C-s C-s' to repeat the last search in a file with long
wrapped lines sometimes fails to lazy-highlight other matches.
This is because the condition in isearch-lazy-highlight-new-loop relies on
the return value of `(sit-for 0)' and when there is input pending like the
second `C-s' keystroke unprocessed due to the large file size with long
lines, it doesn't start a new lazy-highlight loop.
I noticed this problem only after starting to use lazy-count that fails
to count matches. Before that, there was no clear indication that
lazy-highlight failed in such cases.
I doubt that relying on its return value was intentional, so I propose
the following fix:
diff --git a/lisp/isearch.el b/lisp/isearch.el
index dd0973d4ea..5876e70305 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -3661,7 +3661,7 @@ isearch-lazy-highlight-new-loop
search string to change or the window to scroll). It is also used
by other Emacs features."
(when (and (null executing-kbd-macro)
- (sit-for 0) ;make sure (window-start) is credible
+ (progn (sit-for 0) t) ;make sure (window-start) is credible
(or (not (equal isearch-string
isearch-lazy-highlight-last-string))
(not (memq (selected-window)
^ permalink raw reply related [flat|nested] 3+ messages in thread
* bug#33838: 27.0.50; lazy-highlight fails with a quick key sequence
2018-12-23 0:05 bug#33838: 27.0.50; lazy-highlight fails with a quick key sequence Juri Linkov
@ 2018-12-23 23:27 ` Juri Linkov
2018-12-25 21:54 ` Juri Linkov
0 siblings, 1 reply; 3+ messages in thread
From: Juri Linkov @ 2018-12-23 23:27 UTC (permalink / raw)
To: 33838
> Quickly typing `C-s C-s' to repeat the last search in a file with long
> wrapped lines sometimes fails to lazy-highlight other matches.
>
> This is because the condition in isearch-lazy-highlight-new-loop relies on
> the return value of `(sit-for 0)' and when there is input pending like the
> second `C-s' keystroke unprocessed due to the large file size with long
> lines, it doesn't start a new lazy-highlight loop.
I realized that sit-for here is for a reason to not try running
isearch-lazy-highlight-new-loop on every keypress. The problem is that
when the first `C-s' is ignored (in this case isearch-string is an empty
string and isearch-lazy-highlight-last-string is the last search string),
for the second `C-s', isearch-string is equal to isearch-lazy-highlight-last-string
from the last search, so a new loop is not initiated.
A proper fix would be to reset isearch-lazy-highlight-last-string
on exiting Isearch, so it won't affect the next search:
diff --git a/lisp/isearch.el b/lisp/isearch.el
index dd0973d4ea..d2c1c150b5 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -1357,6 +1357,7 @@ isearch-done
(setq minibuffer-message-timeout isearch-original-minibuffer-message-timeout)
(isearch-dehighlight)
(lazy-highlight-cleanup lazy-highlight-cleanup)
+ (setq isearch-lazy-highlight-last-string nil)
(let ((found-start (window-group-start))
(found-point (point)))
(when isearch-window-configuration
^ permalink raw reply related [flat|nested] 3+ messages in thread
* bug#33838: 27.0.50; lazy-highlight fails with a quick key sequence
2018-12-23 23:27 ` Juri Linkov
@ 2018-12-25 21:54 ` Juri Linkov
0 siblings, 0 replies; 3+ messages in thread
From: Juri Linkov @ 2018-12-25 21:54 UTC (permalink / raw)
To: 33838-done
> A proper fix would be to reset isearch-lazy-highlight-last-string
> on exiting Isearch, so it won't affect the next search:
Pushed to master and closed.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-12-25 21:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-23 0:05 bug#33838: 27.0.50; lazy-highlight fails with a quick key sequence Juri Linkov
2018-12-23 23:27 ` Juri Linkov
2018-12-25 21:54 ` Juri Linkov
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.