From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#49534: 26.3; Isearch should support using filter predicates with empty search hits Date: Tue, 13 Jul 2021 22:25:36 +0300 Organization: LINKOV.NET Message-ID: <87zguq6mof.fsf@mail.linkov.net> References: <87czrmrxfv.fsf@gnus.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="30296"; 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: 49534@debbugs.gnu.org, "Richard M. Stallman" To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Jul 13 21:33:12 2021 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 1m3O9X-0007jb-5s for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 13 Jul 2021 21:33:11 +0200 Original-Received: from localhost ([::1]:39644 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m3O9W-0004Yu-27 for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 13 Jul 2021 15:33:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52270) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m3O4Y-0001QW-LX for bug-gnu-emacs@gnu.org; Tue, 13 Jul 2021 15:28:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:58748) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m3O4Y-00063C-CE for bug-gnu-emacs@gnu.org; Tue, 13 Jul 2021 15:28:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1m3O4Y-0004Si-6G for bug-gnu-emacs@gnu.org; Tue, 13 Jul 2021 15:28: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: Tue, 13 Jul 2021 19:28:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49534 X-GNU-PR-Package: emacs Original-Received: via spool by 49534-submit@debbugs.gnu.org id=B49534.162620446617125 (code B ref 49534); Tue, 13 Jul 2021 19:28:02 +0000 Original-Received: (at 49534) by debbugs.gnu.org; 13 Jul 2021 19:27:46 +0000 Original-Received: from localhost ([127.0.0.1]:42059 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m3O43-0004Rq-IB for submit@debbugs.gnu.org; Tue, 13 Jul 2021 15:27:46 -0400 Original-Received: from relay12.mail.gandi.net ([217.70.178.232]:42347) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m3O3y-0004RW-7Q; Tue, 13 Jul 2021 15:27:29 -0400 Original-Received: (Authenticated sender: juri@linkov.net) by relay12.mail.gandi.net (Postfix) with ESMTPSA id 6B9B0200004; Tue, 13 Jul 2021 19:27:16 +0000 (UTC) In-Reply-To: <87czrmrxfv.fsf@gnus.org> (Lars Ingebrigtsen's message of "Tue, 13 Jul 2021 18:27:32 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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:209873 Archived-At: tags 49534 fixed close 49534 28.0.50 quit >> That won't work. Isearch is unnecessarily restrictive because of this >> test in `isearch-search', which if non-nil prevents invoking >> `isearch-filter-predicate'. >> >> (= (match-beginning 0) (match-end 0)) > > And, indeed, the default predicate doesn't match on invisible text... > but I'm not sure why it's also testing the length of the match. (The > default predicate also checks this, so removing the test seems to > produce identical results by default.) I've tried to remove (= (match-beginning 0) (match-end 0)) and then tried the test case provided by Drew, but it goes into an infinite loop. So it requires advancing by 1 char - the same trick as it's used in query-replace, etc. Also I noticed that Drew's test case matches at 'eob' that is wrong. So I moved checks for bobp/eobp outside. The third problem I noticed thanks to Drew's test case is that lazy-highlighting incorrectly highlights empty matches. Fixed as well.