unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: "Harald Jörg" <haj@posteo.de>
To: Michael Albinus <michael.albinus@gmx.de>
Cc: <help-gnu-emacs@gnu.org>
Subject: Re: rx of (any SET...)
Date: Wed, 17 Aug 2022 20:42:36 +0000	[thread overview]
Message-ID: <87y1vmioub.fsf@hajtower> (raw)
In-Reply-To: <87ilmq3mfk.fsf@gmx.de> (Michael Albinus's message of "Wed, 17 Aug 2022 17:43:43 +0200")

Michael Albinus writes:

> Hi,
>
> I have the regexp
>
> (concat "[^" (bound-and-true-p mm-7bit-chars) "]")
>
> I want to write it in rx notation, but I fail. I know how to use xr for
> reverse engineering, but I'd like to keep the variable mm-7bit-chars in
> the rx notation, and not to replace it by the literal string.
>
> How would this look like?

I found that variables can be included in rx forms with some form of
eval, or by using rx-to-string, which is a function and not a macro.

With the value of mm-7bit-chars at macro expansion time:
(rx (eval `(not (any ,mm-7bit-chars))))

With the value of mm-7bit-chars at runtime:
(eval `(rx (not (any ,mm-7bit-chars))))
(rx-to-string `(not (any ,mm-7bit-chars)))

--
Cheers,
haj



  parent reply	other threads:[~2022-08-17 20:42 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-17 15:43 rx of (any SET...) Michael Albinus
2022-08-17 17:13 ` [External] : " Drew Adams
2022-08-17 18:19   ` Michael Albinus
2022-08-17 20:34 ` Michael Heerdegen
2022-08-17 21:37   ` Michael Heerdegen
2022-08-18  0:59     ` Michael Heerdegen
2022-08-17 20:42 ` Harald Jörg [this message]
2022-08-18  9:44   ` Michael Albinus

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=87y1vmioub.fsf@hajtower \
    --to=haj@posteo.de \
    --cc=help-gnu-emacs@gnu.org \
    --cc=michael.albinus@gmx.de \
    /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.
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).