From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.bugs Subject: bug#49534: [External] : Re: bug#49534: 26.3; Isearch should support using filter predicates with empty search hits Date: Tue, 13 Jul 2021 21:44:41 +0000 Message-ID: References: <87czrmrxfv.fsf@gnus.org> <87zguq6mof.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31347"; mail-complaints-to="usenet@ciao.gmane.io" Cc: "49534@debbugs.gnu.org" <49534@debbugs.gnu.org>, "Richard M. Stallman" To: Juri Linkov , Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Jul 13 23:45:29 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 1m3QDY-0007wr-2C for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 13 Jul 2021 23:45:28 +0200 Original-Received: from localhost ([::1]:43200 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m3QDX-0001sm-1Z for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 13 Jul 2021 17:45:27 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:49894) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m3QD8-0001qM-H9 for bug-gnu-emacs@gnu.org; Tue, 13 Jul 2021 17:45:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:58931) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m3QD8-0007FF-5V for bug-gnu-emacs@gnu.org; Tue, 13 Jul 2021 17:45:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1m3QD8-0001rJ-3G for bug-gnu-emacs@gnu.org; Tue, 13 Jul 2021 17:45:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Drew Adams Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 13 Jul 2021 21:45:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49534 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: fixed Original-Received: via spool by 49534-submit@debbugs.gnu.org id=B49534.16262126887112 (code B ref 49534); Tue, 13 Jul 2021 21:45:02 +0000 Original-Received: (at 49534) by debbugs.gnu.org; 13 Jul 2021 21:44:48 +0000 Original-Received: from localhost ([127.0.0.1]:42244 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m3QCu-0001qe-7A for submit@debbugs.gnu.org; Tue, 13 Jul 2021 17:44:48 -0400 Original-Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]:44840) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m3QCr-0001qV-To for 49534@debbugs.gnu.org; Tue, 13 Jul 2021 17:44:46 -0400 Original-Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 16DLg6gr009150; Tue, 13 Jul 2021 21:44:45 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=corp-2020-01-29; bh=QC31uBGS79hAN/qNAFL1UB1+3+FWh6m+8PwKOQLTWGg=; b=c8HeO51d/CZ/od5DG0/8Wul48uw6YY8KU+Zj3j0m0fYu8PwV0APbcQCqC9IUuayZLupl oYbmscZKo+9dMvZzcYOzXWQHXP/gyWPMTesLhDMVHR3+p0iWf3dups7Bj9ZnzzYSowhY Zjm1we88neIR3eWbLFl2+ypiXqfVG5EFqppVbO2gKcBDF3KLEVnlakUTDDNtXBJGTc6b TyTtLpSo36WifEGvHOcAMnAhHg8InnHL880rKQTkV/ircm2ZOotTBOG3XcM9FSRMXMnH +uU9kBx+CaKllLcXOJ9DT0++3RP8WmRrWuIUfP/t9NJeI/uqvEZ2iBLfWMAhfY5Mk94V PQ== Original-Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by mx0b-00069f02.pphosted.com with ESMTP id 39rqm0uer7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 13 Jul 2021 21:44:45 +0000 Original-Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 16DLeXMg193006; Tue, 13 Jul 2021 21:44:44 GMT Original-Received: from nam04-bn8-obe.outbound.protection.outlook.com (mail-bn8nam08lp2048.outbound.protection.outlook.com [104.47.74.48]) by userp3030.oracle.com with ESMTP id 39q0p5wfnt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 13 Jul 2021 21:44:43 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GiBXok5xB/pPC+BVKA0zjt2HeqbdHSImHE1oJKLZkz8HcIQVQl6AFEvZBfRvIh8yla3A85oEKjHpBNwiI2zUWYqNo5GUgxKv4TPL8zftFcPvKYKTz3jfDV35B/4oO64BPsiayvsvcWNmfsijjBpcwSVplsBB73dbPX74IjFUHVKq0x4Q3th/abMy9zLMZsTIpH7X5kL6bFjqziQPm4NrujiwyPJLGc+uOUfovA/+oWSsxQYLJo82vMvTvJaay1xXxVx0g7uFVNciOw+kZNX7Vum+ITJXYHh5AsftatAR9ir/PbUvoFyVGSdib1dJZKAI5t79d00vuHKw5OxW0GdKfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=QC31uBGS79hAN/qNAFL1UB1+3+FWh6m+8PwKOQLTWGg=; b=TsuxD0kUO+VbSF9xHX53xrSiPNKJUoHzm+/ebtN3MzNUkqFffEXNyFNoTN06igshAqEoEW6LfSQj7NLBzm8u+tB/eAdEbcyAyJ6W/rOIRHYqyaOYY4ycT8wOzeLACGtrWZmMdusqNVzBY8mHKMfdnJUsOBzf64uZUSVzg0DuZc5ZpVyJK8ZiOe3mjV0VATI125AAa0emZM8e9sjZzjjrUmJipOYmmvmYdCcw2IFfGUhpo5u2fAVImGGcEyUTtfmEpVK6slC9zlbhoNNqemZ34hj72Rl3wqe23FKBwFrlG/9Iu1q+reLaAyKx/jQVMy8N0oZYWERZzkT81mozBdgYOw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=QC31uBGS79hAN/qNAFL1UB1+3+FWh6m+8PwKOQLTWGg=; b=ouTrJITUEVg0SMbFM13vtygXGvrgXi8GGIANQFxVINHvyfb+j7KLRM9k6wZaUo3IrpWhg1NeUcUchpIoyndbqSL7/9O73WG7KjmulDwsxHgj3NSlVSxbOsFdriIHnFVV+apop7MzsOz7GZjq4iQLg1U+ZV9C5gZJDDRup3YtGto= Original-Received: from SJ0PR10MB5488.namprd10.prod.outlook.com (2603:10b6:a03:37e::19) by SJ0PR10MB4446.namprd10.prod.outlook.com (2603:10b6:a03:2d9::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4308.20; Tue, 13 Jul 2021 21:44:42 +0000 Original-Received: from SJ0PR10MB5488.namprd10.prod.outlook.com ([fe80::1d3c:d31b:8add:1958]) by SJ0PR10MB5488.namprd10.prod.outlook.com ([fe80::1d3c:d31b:8add:1958%5]) with mapi id 15.20.4308.027; Tue, 13 Jul 2021 21:44:41 +0000 Thread-Topic: [External] : Re: bug#49534: 26.3; Isearch should support using filter predicates with empty search hits Thread-Index: Add3KtHOVbhX4iMwQf2riJuDn1/IigA8kzbgAAKdmeA= In-Reply-To: <87zguq6mof.fsf@mail.linkov.net> Accept-Language: en-US Content-Language: en-US authentication-results: linkov.net; dkim=none (message not signed) header.d=none;linkov.net; dmarc=none action=none header.from=oracle.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: c18749fa-d1f3-4466-1d14-08d946476c19 x-ms-traffictypediagnostic: SJ0PR10MB4446: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8882; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: SFBSFYeziXog1DJ1aIIpRmFD9mBenI0NMiIP1ueJsz2EnB8rV+IJ9TW8yb7DHl7i//Q0X8EMZvZ+NHU34Jjf7tVz4sZ3viR8kYNNTWxdHoy4Lv0R0ynqj9FlybJPa0+0LHPUsGANGPx0hZzLS+CgAhrnlNEP5S4oTqHpHH5GzBOW/DL0TZdse95zaxTnS6uLGYP9dKGlpb3MhGa1I9iWivZi/4M/PcSMIWTtTc/XnBqZpmyNN6uBNCWqhwfFKnhUmb3RT7SO4SK/C4PGUZv8WEaXgDiGEHK+kDxJag29KoKGpL97sL/RngdYaSQU3Vzfe5ShZZo6obEv34qmcAwNGpyorSbROTTfWxZTwEmdLaBqUx53ECvSiXXCffxIxpK4iOawpp2XQ9Av3cXP10hKD+qOkwJGMbo8VIrHT200rtJEDcaW6HpsOaLeMRywpYPYJxCRoH4jkhADTI+oUFK8R3KEQi3lJoD/gI40KAdJG+YIr5Pai0GEIfIrxd6kr1nNE2YNdqBe/im2XWpmUxWscaPC5G8ChlvKljwxip936k+Eg39maFV2lScnjaSvNOFcjDOh7z8RRKEWJox4STr4FSUvxByRJbNW+tfoSmDMKsI5DZKVLjQoRIblBgrsgf6pF8qQjvMyiqUhMclOcU5Vcu2dJJLA8vpkDOWsFEQZ9AW2kn/Nyzjpf7ze1M8U2AQjEI+flTXQm9MSzKw/E+vX4w== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR10MB5488.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(136003)(39860400002)(346002)(376002)(396003)(366004)(52536014)(83380400001)(478600001)(5660300002)(66446008)(6506007)(66946007)(66556008)(86362001)(122000001)(26005)(186003)(64756008)(76116006)(4326008)(54906003)(38100700002)(66476007)(71200400001)(7696005)(9686003)(44832011)(316002)(2906002)(33656002)(8676002)(55016002)(8936002)(110136005)(38070700003); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: UJ0VcAFc3mSnfoMZCRchdajUf5+n9dgdTZ+zOcS57V+Pyf5nJEOxkqL/7MzZWN4VOy4QSuZ1Saitu+HMr3tyYlbsZkpyATZkrG0YcursAeLt0fr6KaN062OLRzZm8I15hdz6je3A0XOxpxiXSRhx2aODLG051dQULom3LqYSLL7xfvBS2dDF/GQCzIuML4PsJZs51PSdNY53e+W2VZqAJr1rfPvdRQ27bDgQ7BAZyS6Xx4j5ohDnMFjtWJzOk28PZuDXtQAwqWklT8uyLS1j+OcaMYtNcrObbWrVqYGN5x0vBBtsVQfPBjNyFl6jbEPWwYNBTQHNxRAUrpNX0lU/h2Fq/EeW9OFia2nzEJpO+Vt5RjXH1bR3wv89Kq98PVCPs4kDrLPInAZlL2BMF43NULcCUX6agP3hQQ05pFVrbYaprSdQkcCx1J8R3nyChd9EHKGJh0Rl7H/izjeCtLhr8pnkDzLwDHubcn7q6OPrm7bBbMXawpDagoXdORQH57N9q8GqUuDYmPzU0IY99fayIVAviRZUF+Rjb07+xA30lTwsHDUxyvbUd33WCP36CrVxU38sFWewJB2xnH7mrGDaxDsPktjUFFGVhgwfthdAOU1fpg2tbARDjLI6csV4njw3L1D1vxGxCA7FG8IjqEMQ7yRn27B2LfAnxGFMxlyCZaFJC3h0BUp1N5miMesRy7pfgyRDlfqeX45iZ5JkIu3k2OLCKZ7o2VmIauPq8+no31g6BVMDlauR8Ll6mX WjP3InS3ZrIsu7R0RChgu8Fj7AuYaYSsyXBOo0F+NWsJ8oeDVKpXfG7Zkye/FvSjUzNbvsfWs8/55VZCg17DprnL1BhwyB/s17 x-ms-exchange-transport-forked: True X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: SJ0PR10MB5488.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: c18749fa-d1f3-4466-1d14-08d946476c19 X-MS-Exchange-CrossTenant-originalarrivaltime: 13 Jul 2021 21:44:41.8429 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 9B1snAc5kbRgg3sp2tSS7Wht0L7k5HuT2rGm33GgBFj9eKh36wzDB8Aex9oiP6wFRAZ5zZ2jcs4jcTHvKJUhsg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB4446 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=10044 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 adultscore=0 phishscore=0 spamscore=0 bulkscore=0 mlxlogscore=999 mlxscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2107130133 X-Proofpoint-GUID: 8WnsAOCR3xP7kquohLrP7hM0ATv7GJNu X-Proofpoint-ORIG-GUID: 8WnsAOCR3xP7kquohLrP7hM0ATv7GJNu 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:209886 Archived-At: > I've tried to remove (=3D (match-beginning 0) (match-end 0)) > and then tried the test case provided by Drew, > but it goes into an infinite loop. >=20 > So it requires advancing by 1 char - the same trick as it's used > in query-replace, etc. Yes, my code does that. > Also I noticed that Drew's test case matches at 'eob' > that is wrong. So I moved checks for bobp/eobp outside. What do you mean by Drew's test case? Do you mean the updated isearch+.el definition of `isearch-search', with th= e bug fix? That is, do you mean this code? (when (or (not isearch-success) (isearchp-reached-limit-p) ; <=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D (funcall isearch-filter-predicate (match-beginning 0) (match-end 0))) (setq retry nil)) where (defun isearchp-reached-limit-p () "Return non-nil if at search-boundary limit in current search direction." (if isearch-forward (or (eobp) ; <=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D (and isearchp-reg-end (> (point) isearchp-reg-end))) (or (bobp) ; <=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D (and isearchp-reg-beg (< (point) isearchp-reg-beg))))) Is that the use of `eobp' you're talking about? (If not, what is?) That `isearchp-reached-limit-p' just replaces the original isearch.el code, which just tested (or (bobp) (eobp)): (or (not isearch-success) (bobp) (eobp) ; <=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D (=3D (match-beginning 0) (match-end 0)) (funcall isearch-filter-predicate (match-beginning 0) (match-end 0)))=20 My code just uses the (original) region limits instead of the buffer limits, when searching the active region. Your code (in master) removes that boundary test altogether (no `bobp' or `eobp' test). Why is that the right thing? Is it because the match should be allowed to match up to `bobp' or `eobp'? If so, why was that test in isearch.el in the first place? Actually, you do still test for reaching the boundary, but only for an empty match and after filter failure. Why is that? And why do you not need to back up a char after the loop, if the match was empty the last time around and the next time it fails? It'll have advanced a char; should it stay there instead of backing up? (Dunno, but I supposed not.) Our code in those spots is slightly different. I'd like to know why you did just as you did. > The third problem I noticed thanks to Drew's test case > is that lazy-highlighting incorrectly highlights empty matches. > Fixed as well. Yes, I left that code alone for the moment, but your change is no doubt the right thing there.