From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.bugs Subject: bug#34150: 26.1; Document filtering with `isearch-filter-predicate' in Elisp manual Date: Sun, 20 Jan 2019 16:17:41 -0800 (PST) Message-ID: <8c207ca2-39ae-4ec1-acbd-358165964319@default> NNTP-Posting-Host: ciao.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: ciao.gmane.org 1548029893 170802 195.159.176.228 (21 Jan 2019 00:18:13 GMT) X-Complaints-To: usenet@ciao.gmane.org NNTP-Posting-Date: Mon, 21 Jan 2019 00:18:13 +0000 (UTC) To: 34150@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Jan 21 01:18:10 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1glNHz-000iJb-PY for geb-bug-gnu-emacs@m.gmane.org; Mon, 21 Jan 2019 01:18:08 +0100 Original-Received: from localhost ([127.0.0.1]:45925 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1glNI8-0007Aq-RD for geb-bug-gnu-emacs@m.gmane.org; Sun, 20 Jan 2019 19:18:16 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:44995) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1glNHv-00078a-99 for bug-gnu-emacs@gnu.org; Sun, 20 Jan 2019 19:18:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1glNHu-0007eL-9o for bug-gnu-emacs@gnu.org; Sun, 20 Jan 2019 19:18:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:40014) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1glNHu-0007eD-6K for bug-gnu-emacs@gnu.org; Sun, 20 Jan 2019 19:18:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1glNHt-0000gc-R2 for bug-gnu-emacs@gnu.org; Sun, 20 Jan 2019 19:18:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Drew Adams Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 21 Jan 2019 00:18:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 34150 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.15480298772625 (code B ref -1); Mon, 21 Jan 2019 00:18:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 21 Jan 2019 00:17:57 +0000 Original-Received: from localhost ([127.0.0.1]:39295 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1glNHo-0000gH-Gd for submit@debbugs.gnu.org; Sun, 20 Jan 2019 19:17:56 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:34743) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1glNHn-0000g2-0m for submit@debbugs.gnu.org; Sun, 20 Jan 2019 19:17:55 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:45800) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1glNHh-0007UO-Ry for submit@debbugs.gnu.org; Sun, 20 Jan 2019 19:17:49 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:44937) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1glNHg-000722-RQ for bug-gnu-emacs@gnu.org; Sun, 20 Jan 2019 19:17:49 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1glNHf-0007PQ-K5 for bug-gnu-emacs@gnu.org; Sun, 20 Jan 2019 19:17:48 -0500 Original-Received: from aserp2130.oracle.com ([141.146.126.79]:33030) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1glNHf-0007OF-B1 for bug-gnu-emacs@gnu.org; Sun, 20 Jan 2019 19:17:47 -0500 Original-Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id x0L0F68A025583 for ; Mon, 21 Jan 2019 00:17:44 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=mime-version : message-id : date : from : sender : to : subject : content-type : content-transfer-encoding; s=corp-2018-07-02; bh=0KZhYKg0k4awq5DxsmK7fFVrATjxxnOBTkcDfcdWk4o=; b=p/CN3HjeOnIZYzazRqbsxcgcI2gcMfyC1apAY94uwAa6H01tYQevXD51DXFak0ptDg/R 5e7oUCGbrh9Tf9C3miidqNW6kj0GQLS5KYQwcyth4yBgu4WTf6nknr3j3ElaoH54l8T1 NXRP9c5XoV9I4ovJO1FF8c7Eg0zw7uZzQZuA1ALtvKz+c50Dn0yojNrKzAhiKisxOQjA Duh9SN/SbKjkYjN+CgV2VgWzdYi82dpinPGVhBsjhcCSwMiBCbEiGyegVg1kjPPPRF4r Zxluy6V7UAMoNPgFzakiFfmR3kG2tiTiVJq5apLWWTRH4pwXs5GQMt5Mw6c/7zXKzT0Q eQ== Original-Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by aserp2130.oracle.com with ESMTP id 2q3sde47rx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 21 Jan 2019 00:17:43 +0000 Original-Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id x0L0HgDE008890 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 21 Jan 2019 00:17:43 GMT Original-Received: from abhmp0015.oracle.com (abhmp0015.oracle.com [141.146.116.21]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x0L0Hgfu027413 for ; Mon, 21 Jan 2019 00:17:42 GMT X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1 (1003210) [OL 16.0.4795.0 (x86)] X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9142 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1901210001 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:154630 Archived-At: See https://emacs.stackexchange.com/q/47302/105, as one possible motivaton. The only doc I can find about making Isearch and `perform-replace' (all of its uses) ignore/exclude certain matches is the doc string of variable `isearch-filter-predicate'. And that doc string isn't very precise about the args of the predicate. It says only: "The function has two arguments: the positions of start and end of text matched by the search." It would help to add that these positions are `(match-beginning 0)' and `(match-end 0)', respectively, and to say that the match start position is the first of the two args. (Sure, start coming first is not surprising, but it also doesn't follow from the description.) I suggest adding a short topic about filtering with this predicate, perhaps with a simple example. At least mention that this is used in the predefined search commands (including Isearch) and the predefined replacement commands. It would also be good to state whether predefined search functions such as `re-search-forward' respect it. (I imagine that they do not, but I haven't checked, and there's no doc about this AFAIK.) You could guess no, based on the `isearch' part of the variable name. But if you guess like that then you likely won't also guess that the variable applies to `perform-replace' - it's not just about Isearch. One thing that it would also be good to make extra clear is that filtering takes place _after_ input matching; it is not part of matching. Not getting this can be a gotcha with greedy regexp matching. For example, a filter predicate that excludes matches that extend past column 70 does not keep the part of a match before column 70, even if that part also matches the same regexp. In GNU Emacs 26.1 (build 1, x86_64-w64-mingw32) of 2018-05-30 Repository revision: 07f8f9bc5a51f5aa94eb099f3e15fbe0c20ea1ea Windowing system distributor `Microsoft Corp.', version 10.0.17134 Configured using: `configure --without-dbus --host=3Dx86_64-w64-mingw32 --without-compress-install 'CFLAGS=3D-O2 -static -g3''