help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: rx and rx-to-string handle (regexp VAR) differently


From: Michael Heerdegen
Subject: Re: rx and rx-to-string handle (regexp VAR) differently
Date: Fri, 09 Jun 2023 03:36:48 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

Platon Pronko <platon7pronko@gmail.com> writes:

> rx-to-string docs explicitly say: "The arguments to ‘literal’ and
> ‘regexp’ forms inside FORM must be constant strings."

Is this a correct way to get what Kévin wants?

#+begin_src emacs-lisp
  (setq foo-regexp "fo+")
  (rx-define foo (eval `(regexp ,foo-regexp)))
#+end_src

This also works in both cases:

#+begin_src emacs-lisp
  (setq foo-regexp '(regexp "fo+"))
  (rx-define foo (eval foo-regexp))
#+end_src


Michael.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]