From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Michael Heerdegen Newsgroups: gmane.emacs.bugs Subject: bug#27659: 26.0.50; Add string-matched-text: string-match + match-string Date: Sat, 22 Jul 2017 03:46:27 +0200 Message-ID: <87mv7x451o.fsf@drachen> References: <87fue2rxm1.fsf@calancha-pc> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1500688034 14027 195.159.176.226 (22 Jul 2017 01:47:14 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 22 Jul 2017 01:47:14 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) Cc: 27659@debbugs.gnu.org, Tino Calancha To: Philipp Stephani Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Jul 22 03:47:07 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1dYjVa-0003EV-DW for geb-bug-gnu-emacs@m.gmane.org; Sat, 22 Jul 2017 03:47:06 +0200 Original-Received: from localhost ([::1]:45402 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dYjVf-00023B-Tb for geb-bug-gnu-emacs@m.gmane.org; Fri, 21 Jul 2017 21:47:11 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46258) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dYjVZ-00022u-U8 for bug-gnu-emacs@gnu.org; Fri, 21 Jul 2017 21:47:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dYjVW-0004bO-Ti for bug-gnu-emacs@gnu.org; Fri, 21 Jul 2017 21:47:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:49043) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dYjVW-0004bC-QG for bug-gnu-emacs@gnu.org; Fri, 21 Jul 2017 21:47:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dYjVW-0001rs-Cq for bug-gnu-emacs@gnu.org; Fri, 21 Jul 2017 21:47:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Michael Heerdegen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 22 Jul 2017 01:47:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 27659 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: wontfix Original-Received: via spool by 27659-submit@debbugs.gnu.org id=B27659.15006880007152 (code B ref 27659); Sat, 22 Jul 2017 01:47:02 +0000 Original-Received: (at 27659) by debbugs.gnu.org; 22 Jul 2017 01:46:40 +0000 Original-Received: from localhost ([127.0.0.1]:51720 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dYjV9-0001rI-Ue for submit@debbugs.gnu.org; Fri, 21 Jul 2017 21:46:40 -0400 Original-Received: from mout.web.de ([217.72.192.78]:59779) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dYjV6-0001r4-Oz for 27659@debbugs.gnu.org; Fri, 21 Jul 2017 21:46:38 -0400 Original-Received: from drachen.dragon ([178.0.9.210]) by smtp.web.de (mrweb102 [213.165.67.124]) with ESMTPSA (Nemesis) id 0ML8X7-1dZ0c93E3d-000Kc7; Sat, 22 Jul 2017 03:46:28 +0200 In-Reply-To: (Philipp Stephani's message of "Thu, 20 Jul 2017 19:51:22 +0000") X-Provags-ID: V03:K0:dOftMRUHsMFsjZRkm5/pIfVmeh+Jyrc6+orJ3Ob8d61LeDzt1GC 1xjkLS4fPC4znkPwZfhQSaHiZjpcbCkhRvQdhjOf30YMCBv2kcgwTJnHSMsHYIlV0fT09NH mhxateIjOkjuLxrHAzrw/KvUa+zd1tzPkaznRreE6BeIsnbcej2qoPKoBLLWFrkRHS4zKpu i9aG2O28Pt5chTfjar0Dw== X-UI-Out-Filterresults: notjunk:1;V01:K0:LN3/mLnMl+Q=:KnJnf76x7gxOl5h/5CYoo6 c5sbdBAUTe8U63sQ7KmYnpSQAaFLx6VGqqyDw2Ez6BVLWzAufiIGLy/Y67Lmw/dIywE4Jnhvj oTCjsPVRxuJe9KmfvShrEs29pbqCxWOLg3ZuFTJD53vHXYPnOF78+DY7v1kj0BAiHb6YJVpbM rLAeuVxIL/YDAmtVq26RY8RdCEuFITtHAXnofBG8802VekeBGHsJtJSv2yEFFISz4xiJ963ci EJ8ffNJkAfKelRmdUN128oeIzThcsom2yLhkGEIATE8jqzWkWBDrTe8ePEzMgsAx6sr7SmQkc nAtDNQ7+P8qL13tyWr0Y8nqswZCrhszpk96SAO44dD9hSOyvyIvHVb+NZOxrpxJAv5gBIVbfS GXfTz15LPBT9w9D9L6c3IkHfVcikfiKmr/1RT/wZTqLgt5ftZwiRZag5kyZuSKOdmLsdoKNOb olGsnzKNP9LaFJ4CA8dSQHtuAeLqiymmr4zHjwY/u5UquuPTE3xc/LXH0ZLfvQUW+7SKuR0yv zzrypUpAIzsQMeSm7BzwYBexXwF2hBN1Aav045Wr3e6EC0q0vkXtcHtcBrxi/Pb4NvHtKAjxD MI1pWNUQDDYxf7S/Hu/nQxKCczdGhxeBrjAENJgAWjhW2IoqDD/VCLDDYH72+iii+JnRUYEIV 3L427kMo7sZPrIdF2QLQHMmSVRT9bbXRJfsS5IYw22ciGfsOdAEiVON3DaUPrLLCQ5nWVY7KX QtpY6ff2xvbKEIrq9JQ7O8j0ax5li9rfXnJv2vTiADGiMaTTNiMsvR6Lf5jJNKpC25Z+MgSP 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: 208.118.235.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:134835 Archived-At: Hi Philipp, nice idea! I have some questions: +(pcase-defmacro rx (&rest regexps) + "Build a `pcase' pattern matching `rx' regexps. +The REGEXPS are interpreted as by `rx'. Should we tell what the semantics of multiple REGEXPS is? I guess they are implicitly wrapped inside rx-`and' (but FWIW, the doc of `rx' also fails to tell that). +Within the case code, the match data is bound as usual, but you This makes it sound like match data is bound pcase-branch-locally. This isn't the case, right? +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. This made me wonder what FORM should be. I think it means any rx symbolic expression, so the name FORM seems misleading. +(ert-deftest pcase-tests-rx () + (should (equal (pcase "a 1 2 3 1 b" + ((rx (let u (+ digit)) space + (let v (+ digit)) space + (let v (+ digit)) space + (backref-var u)) + (list u v))) + '("1" "3")))) + I don't understand the example (or test). Is v first bound to 2, and after that rebound to 3? This seems at least surprising, since let behaves differently in pcase, e.g. (pcase 'foo ((and (let x 1) (let x 2)) x)) ==> nil Hmm, in general I see the risk of confusing this `let' with `pcase' let. It seems to be something very different. Maybe you could just pick a different name, `bind' maybe? Michael.