Subject: bug#36237: Support (rx (and (regexp EXPR) (regexp-quote EXPR)))

From: Andy Moreton <[email-masked]>
Date: Wed, 26 Jun 2019 13:23:53 +0100

On Tue 25 Jun 2019, Noam Postavsky wrote:

> tags 36237 fixed
> close 36237 27.1
> quit
>
>> I'll wait a few more days in case something else comes up.
>
> Pushed to master.
>
> b59ffd2290 2019-06-25T22:00:03-04:00 "Support (rx (and (regexp EXPR) (literal EXPR))) (Bug#36237)"
> https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=b59ffd2290ff744ca4e7cc2748ba6b66fb2f99f1

With "emacs -Q" from emacs-26:

  (setq foo (rx (group (or "abc" "def"))))
  => "\\(\\(?:abc\\|def\\)\\)"

  (setq bar (rx-to-string `(regexp ,foo)))
  => "\\(?:\\(\\(?:abc\\|def\\)\\)\\)"

  (setq bar (rx (regexp foo)))
  => error "rx form ‘regexp’ requires args satisfying ‘stringp’"

With "emacs -Q from master:

  (setq foo (rx (group (or "abc" "def"))))
  => "\\(\\(?:abc\\|def\\)\\)"

  (setq bar (rx-to-string `(regexp ,foo)))
  => ("\\(?:" "\\)")       ; unexpected result

  (setq bar (rx (regexp foo)))
  => "\\(?:\\(\\(?:abc\\|def\\)\\)\\)"

Please fix this regression.

    AndyM