Subject: bug#37440: [PATCH] New rx implementation with extension constructs

From: Mattias Engdegård <[email-masked]>
Date: Wed, 25 Sep 2019 14:33:46 +0200

24 sep. 2019 kl. 19.55 skrev Paul Eggert <[email-masked]>:
> 
> I tried the proposed patches with current Emacs master on Fedora 30 x86-64 and got a test failure as shown in the attached file. 

Thank you! Those failures only occur when running test loaded from a byte-compiled file -- I suppose you used TEST_LOAD_EL=no.

First, the unibyte and multibyte forms of a string like "\326" print the same but aren't equal:

(string-to-multibyte "\326")
=> "\326"
(equal (string-to-multibyte "\326") "\326")
=> nil

This means that if a multibyte string ends up as a constant in byte-compiled code, surprise, it may become a unibyte value when loaded. The test had to be made to work both interpreted and compiled. Fortunately the regexp engine was recently fixed with respect to raw bytes, making its semantics invariant for strings with the same print representation, so this is not a problem with the rx implementation.

The second item of interest was that `rx-define', since it relies on `eval-and-compile', doesn't expand to code when macroexpanded. I don't know if it will be a problem in practice. The test now uses an auxiliary function as work-around.

Updated patches attached.