From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#40808: 27.0.91; inaccuracy in isearch-lazy-count Date: Sat, 25 Apr 2020 23:53:39 +0300 Organization: LINKOV.NET Message-ID: <87ftcrux08.fsf@mail.linkov.net> References: <41ce1bd9-2ddb-a46b-3cb9-2b1b25e48438@net-c.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="57476"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) Cc: 40808@debbugs.gnu.org To: Abdullah Asad Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Apr 25 22:55:13 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1jSRpQ-000EpO-K1 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 25 Apr 2020 22:55:12 +0200 Original-Received: from localhost ([::1]:47402 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jSRpP-0005J8-Jb for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 25 Apr 2020 16:55:11 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:49038) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jSRpH-0005I8-Fr for bug-gnu-emacs@gnu.org; Sat, 25 Apr 2020 16:55:03 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jSRpG-0006a7-UX for bug-gnu-emacs@gnu.org; Sat, 25 Apr 2020 16:55:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:48927) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jSRpG-0006a1-Ik for bug-gnu-emacs@gnu.org; Sat, 25 Apr 2020 16:55:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jSRpG-00071V-Hw for bug-gnu-emacs@gnu.org; Sat, 25 Apr 2020 16:55:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 25 Apr 2020 20:55:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 40808 X-GNU-PR-Package: emacs Original-Received: via spool by 40808-submit@debbugs.gnu.org id=B40808.158784808126960 (code B ref 40808); Sat, 25 Apr 2020 20:55:02 +0000 Original-Received: (at 40808) by debbugs.gnu.org; 25 Apr 2020 20:54:41 +0000 Original-Received: from localhost ([127.0.0.1]:60472 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jSRou-00070m-Q8 for submit@debbugs.gnu.org; Sat, 25 Apr 2020 16:54:41 -0400 Original-Received: from relay7-d.mail.gandi.net ([217.70.183.200]:45955) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jSRop-00070K-TT for 40808@debbugs.gnu.org; Sat, 25 Apr 2020 16:54:36 -0400 X-Originating-IP: 91.129.106.11 Original-Received: from mail.gandi.net (m91-129-106-11.cust.tele2.ee [91.129.106.11]) (Authenticated sender: juri@linkov.net) by relay7-d.mail.gandi.net (Postfix) with ESMTPSA id C3B3E20003; Sat, 25 Apr 2020 20:54:29 +0000 (UTC) In-Reply-To: <41ce1bd9-2ddb-a46b-3cb9-2b1b25e48438@net-c.com> (Abdullah Asad's message of "Fri, 24 Apr 2020 12:12:39 +0530") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:179037 Archived-At: > 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'.