[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#40808: 27.0.91; inaccuracy in isearch-lazy-count
From: |
Juri Linkov |
Subject: |
bug#40808: 27.0.91; inaccuracy in isearch-lazy-count |
Date: |
Sat, 25 Apr 2020 23:53:39 +0300 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) |
> When using isearch with isearch-lazy-count in org mode with heading
> collapsed isearch gives wrong number of matches (both total & current).
>
> Reproducing it is simple just enable isearch-lazy-count and perform
> isearch in org buffer with collapsed heading.
Thanks for bringing up this question, it will help to fix this feature
for the upcoming release. I tend to agree that isearch-lazy-count
should show the number of *all* matches in the buffer, even the matches that
are invisible, and that can be opened when visited by isearch navigation.
Eli, do you agree with this patch for emacs-27. It counts all matches, even
invisible. And also it fixes an old bug existed in previous Emacs versions
where lazy-highlight didn't update lazy-highlighting when a hidden outline
was automatically opened at the end of the file (I noticed this bug only now).
So the condition ‘(eq search-invisible 'open)’ fixes an old bug, and
the condition ‘isearch-lazy-count’ fixes the new feature added in emacs-27:
diff --git a/lisp/isearch.el b/lisp/isearch.el
index e13a4dda83..ed1097c5ea 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -319,7 +319,7 @@ isearch-lazy-count
"Show match numbers in the search prompt.
When both this option and `isearch-lazy-highlight' are non-nil,
show the current match number and the total number of matches
-in the buffer (or its restriction)."
+in the buffer (or its restriction), including all hidden matches."
:type 'boolean
:group 'lazy-count
:group 'isearch
@@ -3869,7 +3871,8 @@ isearch-lazy-highlight-search
(isearch-regexp-lax-whitespace
isearch-lazy-highlight-regexp-lax-whitespace)
(isearch-forward isearch-lazy-highlight-forward)
- (search-invisible nil) ; don't match invisible text
+ ;; don't match invisible text unless it can open or counting
matches
+ (search-invisible (or (eq search-invisible 'open)
isearch-lazy-count))
(retry t)
(success nil))
;; Use a loop like in `isearch-search'.
- bug#40808: 27.0.91; inaccuracy in isearch-lazy-count, Abdullah Asad, 2020/04/24
- bug#40808: 27.0.91; inaccuracy in isearch-lazy-count,
Juri Linkov <=
- bug#40808: 27.0.91; inaccuracy in isearch-lazy-count, Abdullah Asad, 2020/04/28
- bug#40808: 27.0.91; inaccuracy in isearch-lazy-count, Eli Zaretskii, 2020/04/28
- bug#40808: 27.0.91; inaccuracy in isearch-lazy-count, Juri Linkov, 2020/04/28
- bug#40808: 27.0.91; inaccuracy in isearch-lazy-count, Eli Zaretskii, 2020/04/29
- bug#40808: 27.0.91; inaccuracy in isearch-lazy-count, Juri Linkov, 2020/04/29
- bug#40808: 27.0.91; inaccuracy in isearch-lazy-count, Juri Linkov, 2020/04/30