]> git.eshelyaron.com Git - emacs.git/commit
Fix rx `regexp` form with deprecated syntax
authorMattias Engdegård <mattiase@acm.org>
Thu, 18 Feb 2021 10:11:11 +0000 (11:11 +0100)
committerMattias Engdegård <mattiase@acm.org>
Thu, 18 Feb 2021 10:32:50 +0000 (11:32 +0100)
commit892db042a0d85caeea9a4969073e13f525eb9f60
tree9f788aa6079518167673d2510b8ae5306fe5c872
parent8358637936c455d906675932db4cbf90c35b6c53
Fix rx `regexp` form with deprecated syntax

The argument of the rx `regexp` form is assumed to evaluate to a valid
regexp, but certain kinds of deprecated but still accepted usage were
not handled correctly, such as unescaped literal (special) characters:
 (rx "a" (regexp "*")) => "a*" which is wrong.
Handle these cases; there is no extra trouble.

* lisp/emacs-lisp/rx.el (rx--translate-regexp): Force bracketing
of single special characters.
* test/lisp/emacs-lisp/rx-tests.el (rx-regexp): Add test case.
lisp/emacs-lisp/rx.el
test/lisp/emacs-lisp/rx-tests.el