From: "Mattias Engdegård" <mattiase@acm.org>
To: Noam Postavsky <npostavs@gmail.com>
Cc: Michael Heerdegen <michael_heerdegen@web.de>,
36237@debbugs.gnu.org, Stefan Monnier <monnier@iro.umontreal.ca>,
kevin.legouguec@gmail.com
Subject: bug#36237: Support (rx (and (regexp EXPR) (regexp-quote EXPR)))
Date: Sun, 23 Jun 2019 13:09:46 +0200 [thread overview]
Message-ID: <5B00DCD9-0718-44AF-89C1-110CFDC17444@acm.org> (raw)
In-Reply-To: <877e9duvg9.fsf@gmail.com>
23 juni 2019 kl. 00.05 skrev Noam Postavsky <npostavs@gmail.com>:
>
> 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
>
> No, it's not generic, see (info "(elisp) Intro Eval"):
>
> 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.
next prev parent reply other threads:[~2019-06-23 11:09 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-15 23:43 bug#36237: Support (rx (and (regexp EXPR) (regexp-quote EXPR))) Noam Postavsky
2019-06-16 0:03 ` Michael Heerdegen
2019-06-16 0:28 ` Noam Postavsky
2019-06-16 10:03 ` Mattias Engdegård
2019-06-16 11:34 ` Stefan Monnier
2019-06-16 12:25 ` Noam Postavsky
2019-06-16 12:35 ` Stefan Monnier
2019-06-16 19:50 ` Noam Postavsky
2019-06-16 20:04 ` Stefan Monnier
2019-06-16 20:25 ` Drew Adams
2019-06-16 20:34 ` Mattias Engdegård
2019-06-16 21:09 ` Drew Adams
2019-06-17 20:57 ` Juri Linkov
2019-06-18 19:45 ` Mattias Engdegård
2019-06-19 1:34 ` Noam Postavsky
2019-06-19 15:42 ` Mattias Engdegård
2019-06-20 0:29 ` Noam Postavsky
2019-06-20 10:26 ` Mattias Engdegård
2019-06-22 22:05 ` Noam Postavsky
2019-06-23 11:09 ` Mattias Engdegård [this message]
2019-06-23 15:46 ` Noam Postavsky
2019-06-24 3:50 ` Stefan Monnier
2019-06-24 10:52 ` Mattias Engdegård
2019-06-26 2:07 ` Noam Postavsky
2019-06-23 14:45 ` Drew Adams
2019-06-26 12:23 ` Andy Moreton
2019-06-26 12:56 ` Noam Postavsky
2019-06-26 13:08 ` Andy Moreton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5B00DCD9-0718-44AF-89C1-110CFDC17444@acm.org \
--to=mattiase@acm.org \
--cc=36237@debbugs.gnu.org \
--cc=kevin.legouguec@gmail.com \
--cc=michael_heerdegen@web.de \
--cc=monnier@iro.umontreal.ca \
--cc=npostavs@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).