From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Newsgroups: gmane.emacs.bugs Subject: bug#36237: Support (rx (and (regexp EXPR) (regexp-quote EXPR))) Date: Sun, 23 Jun 2019 13:09:46 +0200 Message-ID: <5B00DCD9-0718-44AF-89C1-110CFDC17444@acm.org> References: <87fto9yawl.fsf@gmail.com> <385FA4F7-7FB5-43A2-B571-CFBA20B24123@acm.org> <87tvcmwe6b.fsf@gmail.com> <87o92tw13b.fsf@gmail.com> <877e9duvg9.fsf@gmail.com> Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="74774"; mail-complaints-to="usenet@blaine.gmane.org" Cc: Michael Heerdegen , 36237@debbugs.gnu.org, Stefan Monnier , kevin.legouguec@gmail.com To: Noam Postavsky Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Jun 23 13:10:26 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hf0OA-000JG4-6X for geb-bug-gnu-emacs@m.gmane.org; Sun, 23 Jun 2019 13:10:26 +0200 Original-Received: from localhost ([::1]:44066 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hf0O8-0006Zs-Hg for geb-bug-gnu-emacs@m.gmane.org; Sun, 23 Jun 2019 07:10:24 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:60236) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hf0Nu-0006Pq-5c for bug-gnu-emacs@gnu.org; Sun, 23 Jun 2019 07:10:12 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hf0Np-0008JU-3T for bug-gnu-emacs@gnu.org; Sun, 23 Jun 2019 07:10:07 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:39368) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hf0Nm-0008Ct-IP for bug-gnu-emacs@gnu.org; Sun, 23 Jun 2019 07:10:04 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hf0Nm-0002cc-BI for bug-gnu-emacs@gnu.org; Sun, 23 Jun 2019 07:10:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 23 Jun 2019 11:10:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 36237 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 36237-submit@debbugs.gnu.org id=B36237.156128819410054 (code B ref 36237); Sun, 23 Jun 2019 11:10:02 +0000 Original-Received: (at 36237) by debbugs.gnu.org; 23 Jun 2019 11:09:54 +0000 Original-Received: from localhost ([127.0.0.1]:52912 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hf0Ne-0002c6-9d for submit@debbugs.gnu.org; Sun, 23 Jun 2019 07:09:54 -0400 Original-Received: from mail208c50.megamailservers.eu ([91.136.10.218]:53090 helo=mail194c50.megamailservers.eu) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hf0Nc-0002bv-6H for 36237@debbugs.gnu.org; Sun, 23 Jun 2019 07:09:53 -0400 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1561288189; bh=acXNXtF3i0GcFQ2ycftS/UL88j8aMg2BLbzBnLU4bI0=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From; b=nbmfjqM1Gbuemlt8siFXZtZwuLwN4j2nYDCRZhAlStdj4iRA9zhkRnRX/MRhJlaWj vHhu7oRO9GfRqYRpanJ2cLxYpijqGFzYXnjh15vnxTuVUrLuOfzv26bmfe65T8tcI7 vpTRsqVCaigeshaviHFjhTb5/cprwhY83XcY0VZo= Feedback-ID: mattiase@acm.or Original-Received: from [192.168.0.4] ([188.150.171.71]) (authenticated bits=0) by mail194c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id x5NB9kSc032500; Sun, 23 Jun 2019 11:09:48 +0000 In-Reply-To: <877e9duvg9.fsf@gmail.com> X-Mailer: Apple Mail (2.3445.104.11) X-CTCH-RefID: str=0001.0A0B0202.5D0F5DFD.000D, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-CTCH-VOD: Unknown X-CTCH-Spam: Unknown X-CTCH-Score: 0.000 X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.3 cv=OuZhNR3t c=1 sm=1 tr=0 a=SF+I6pRkHZhrawxbOkkvaA==:117 a=SF+I6pRkHZhrawxbOkkvaA==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=kj9zAlcOel0A:10 a=pGLkceISAAAA:8 a=1etVCN-2JTeQF3UX0_AA:9 a=CjuIK1q_8ugA:10 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:161096 Archived-At: 23 juni 2019 kl. 00.05 skrev Noam Postavsky : >=20 > Yeah, that applies to most of the examples actually. Updated (and I > found a couple of mistakes in them). Very good, thank you! I double-checked them with xr and only found one = error (see below). >> The paragraph on `eval' uses FORM, which is too generic >=20 > No, it's not generic, see (info "(elisp) Intro Eval"): >=20 > A Lisp object that is intended for evaluation is called a "form" = or > "expression"(1). You are entirely correct, of course; what I meant is that the docs = frequently use "form" for the `rx' whatchamacallits even though they = aren't Lisp expressions. The terminology is a mess; use whatever you = find understandable. >squash! Support (rx (and (regexp EXPR) (literal EXPR))) (Bug#36237) Remnants of rebase editing? ;; "[ \t\n]*:\\([^:]+\\|$\\)" -;; (rx (and (zero-or-more (in " \t\n")) ":" -;; (submatch (or line-end (one-or-more (not (any ?:))))))) +;; (rx (* (in " \t\n")) ":" +;; (submatch (or line-end (+ (not (in ?:)))))) The correct translation of the `or'-pattern is (or (+ (not (any ":"))) eol) since the order of the branches matters. Maybe it's the regexp string = that should be the other way around; hard to tell without any context. ;; "^;;\\s-*\n\\|^\n" -;; (rx (or (and line-start ";;" (0+ space) ?\n) -;; (and line-start ?\n))) +;; (rx (or (seq line-start ";;" (0+ space) ?\n) +;; (seq line-start ?\n))) This should be correct. The regexp compiler translates `[[:space:]]` and = `\s-` to different bytecodes, but as far as I can tell they end up = having identical semantics in the end. Same goes for `[[:word:]]' vs = `\sw' (alias `\w'), and so on. +`(literal STRING-EXPR)' + matches STRING-EXPR literally, where STRING-EXPR is any lisp + expression that evaluates to a string. + +`(regexp REGEXP-EXPR)' + include REGEXP-EXPR in string notation in the result, where + REGEXP-EXPR is any lisp expression that evaluates a string + containing a valid regexp. Missed "to" after "evaluate"? I'm happy with the patch after the obvious fixes.