From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Michael Heerdegen Newsgroups: gmane.emacs.devel Subject: Re: Clarify `pcase' `rx' pattern doc Date: Mon, 18 Jun 2018 14:34:50 +0200 Message-ID: <87in6gff2t.fsf@web.de> References: <87fu1rqr6m.fsf@web.de> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1529325184 27350 195.159.176.226 (18 Jun 2018 12:33:04 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 18 Jun 2018 12:33:04 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: Eli Zaretskii To: Emacs Development Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jun 18 14:32:59 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fUtL8-0006zp-DQ for ged-emacs-devel@m.gmane.org; Mon, 18 Jun 2018 14:32:58 +0200 Original-Received: from localhost ([::1]:34560 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fUtNF-0006G4-M7 for ged-emacs-devel@m.gmane.org; Mon, 18 Jun 2018 08:35:09 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46444) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fUtN4-0006Dm-6r for emacs-devel@gnu.org; Mon, 18 Jun 2018 08:34:59 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fUtN1-0005b6-1W for emacs-devel@gnu.org; Mon, 18 Jun 2018 08:34:58 -0400 Original-Received: from mout.web.de ([212.227.15.14]:51625) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fUtN0-0005Z6-Jb; Mon, 18 Jun 2018 08:34:54 -0400 Original-Received: from drachen.dragon ([188.110.196.170]) by smtp.web.de (mrweb001 [213.165.67.108]) with ESMTPSA (Nemesis) id 0MAdb9-1fNRNA1Z6p-00BuaB; Mon, 18 Jun 2018 14:34:51 +0200 In-Reply-To: <87fu1rqr6m.fsf@web.de> (Michael Heerdegen's message of "Wed, 13 Jun 2018 05:52:01 +0200") X-Provags-ID: V03:K1:A17V58TfPlNhUmrfL1guAfWkRpu+o7fViZ4zH7dfki9wlMQoHNP mNk3j6kAlkvcnXMInKuss0/b1icPXuw/9elE3EsrPJw5hkD1L3PS4NwqhMyUWC2pozsKWcD YYxVA5hyRniyZ0dmUcfViBF/I+JsD2zSSR0+e5628cx54tFVBeN3Ispl+BRe+YmBZeOsfJ0 mGDFkybW6iMDTpVcPzhYQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:LQH7gJ+uXmw=:EQ4a72HbKi7/LvCqw7jwSG y/D63eL4LJ5uHj7gW93uoZEmaj6gSkT/KZe+wkmQg3MHf4pDowYr8ZCOHeLXj0v9FjsGEk+51 Mu2gjUEBJKpktfhXeyZnHeOd41Q4KUqo/TAR95tO6wB5qoRvV+A1bLuKtdaG7Ynp2KGZyO7je t9finyVC2sJbdUgxs5hxDN9y6BeYEKH2zj1Xl5l0D04CKH/+BJClOd7EtLNNouD/Ne21xSWEj yGgrj9wDjyJXynzg1vgogTOshA1WfkYS2KQXZXVPCZzE9IXaY3QqVbJfC7DCVLq05y8jt3fHv hgQoq1whLRpH/4hfZg1Ul33ym/8MSmByS+Rv1qZ2NzEyUiYHS+cBQXxQSJ0/v/RHyd4isAnqY DHfNyfSJsydb/oAtFpEkZstVI1RGRKeWWKDUCAJAfcdUy//XIrtGm8koKJrSRymLVEhv7BLWF NXeWMetMle/yqfwbTRq/G646tkRVn+yeI3fhRuxS5ZSaz8qE1AJnA28fwWNjT1sNPwNMN4ijw bkMy4PFJmBIGDEC+PEJue1PZU730aXavTKd4LH53Lh3FuoEDg2CTZm04fjRVOXMQfZu3A43Pd BCQhJDvGRCLlGgoirxpkRB3xvzthO0W+VbvJiKnLhF40kHSUsh7POtP68fg271l6mZQmlYxhk ZAJzlanLQZgFxgX+DtynjmkvT06o5SaetAtr+fiyKY19zFMootVX80iGpIkcLRBs+r/Rt+sT1 R5SDRB5x1A0rwMjVHfse0sgYkcG3HyUXDdEqOVsO0JiQ3FnoYCUgALrhj1Jwrp2uwoIfjT5O X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 212.227.15.14 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:226450 Archived-At: --=-=-= Content-Type: text/plain Michael Heerdegen writes: > Opinions? For now, I would like to install the following, slightly modified version (I left the first sentence unchanged so that we can care about that systematically in a later commit) into emacs-26. Is that ok? Thanks, Michael. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Tweak-pcase-rx-pattern-documentation.patch >From c03375d0e086c3bc729f9a8b22eccd88804b6548 Mon Sep 17 00:00:00 2001 From: Michael Heerdegen Date: Wed, 13 Jun 2018 01:42:34 +0200 Subject: [PATCH] Tweak 'pcase' 'rx' pattern documentation * lisp/emacs-lisp/rx.el (rx): Improve pattern docstring. --- lisp/emacs-lisp/rx.el | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/lisp/emacs-lisp/rx.el b/lisp/emacs-lisp/rx.el index 85e74f28ef..6c01536380 100644 --- a/lisp/emacs-lisp/rx.el +++ b/lisp/emacs-lisp/rx.el @@ -1183,24 +1183,25 @@ rx (pcase-defmacro rx (&rest regexps) - "Build a `pcase' pattern matching `rx' regexps. -The REGEXPS are interpreted as by `rx'. The pattern matches if -the regular expression so constructed matches EXPVAL, as if -by `string-match'. + "Build a `pcase' pattern matching with `rx' REGEXPS. +The REGEXPS are interpreted as by `rx'. The pattern matches any +string matched by the regular expression so constructed, as if by +`string-match'. An error is raised if the target is not a string. In addition to the usual `rx' constructs, REGEXPS can contain the following constructs: - (let VAR FORM...) creates a new explicitly numbered submatch - that matches FORM and binds the match to - VAR. - (backref VAR) creates a backreference to the submatch - introduced by a previous (let VAR ...) - construct. + (let VAR REGEXPS...) creates a new explicitly numbered + submatch that matches the `rx' REGEXPS + and binds the match to VAR. + (backref VAR-OR-NBR) creates a backreference to the submatch + introduced by a previous (let VAR ...) + construct; VAR-OR-NBR is either a symbol + VAR or a submatch number. It matches the + exact previous submatch. The VARs are associated with explicitly numbered submatches -starting from 1. Multiple occurrences of the same VAR refer to -the same submatch. +starting from 1. If a case matches, the match data is modified as usual so you can use it in the case body, but you still have to pass the correct -- 2.17.1 --=-=-=--