unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: Abdullah Asad <abdullah@net-c.com>
Cc: 40808@debbugs.gnu.org
Subject: bug#40808: 27.0.91; inaccuracy in isearch-lazy-count
Date: Sat, 25 Apr 2020 23:53:39 +0300	[thread overview]
Message-ID: <87ftcrux08.fsf@mail.linkov.net> (raw)
In-Reply-To: <41ce1bd9-2ddb-a46b-3cb9-2b1b25e48438@net-c.com> (Abdullah Asad's message of "Fri, 24 Apr 2020 12:12:39 +0530")

> 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'.





  reply	other threads:[~2020-04-25 20:53 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-24  6:42 bug#40808: 27.0.91; inaccuracy in isearch-lazy-count Abdullah Asad
2020-04-25 20:53 ` Juri Linkov [this message]
2020-04-28 18:46   ` Abdullah Asad
2020-04-28 19:19     ` Eli Zaretskii
2020-04-28 23:54       ` Juri Linkov
2020-04-29  7:11         ` Eli Zaretskii
2020-04-29 20:56           ` Juri Linkov
2020-04-30 20:18             ` Juri Linkov
2020-05-01  5:58               ` Eli Zaretskii
2020-05-03 22:33                 ` Juri Linkov
2020-05-24 21:45                   ` bug#40808: Org-mode " Juri Linkov
2020-05-25  8:49                     ` Bastien
2020-08-26 12:40                       ` Stefan Kangas
  -- strict thread matches above, loose matches on Subject: below --
2021-07-12  1:58 bug#40808: 27.0.91; " Drew Adams
2022-07-07 17:09 ` Juri Linkov
2022-07-08 17:48   ` Juri Linkov
2022-12-10 17:51   ` Juri Linkov
2022-12-12 17:44     ` Juri Linkov
2022-12-28 18:54       ` Juri Linkov

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=87ftcrux08.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=40808@debbugs.gnu.org \
    --cc=abdullah@net-c.com \
    /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).