branch: externals/relint
commit 6a07508cc257227028d285f971d39fa4aea22283
Author: Mattias Engdegård <[email protected]>
Commit: Mattias Engdegård <[email protected]>
Handle rx `eval' form correctly
The `eval' argument can yield an arbitrary rx form, not just a string.
---
relint.el | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/relint.el b/relint.el
index d1654fb..fab4e44 100644
--- a/relint.el
+++ b/relint.el
@@ -405,7 +405,14 @@ alternatives. They may still require wrapping their
function arguments.")
rx)
;; We ignore the differences in evaluation time between `eval' and
;; `regexp', and just use what environment we have.
- ((memq (car rx) '(literal eval regexp regex))
+ ((eq (car rx) 'eval)
+ (let ((arg (relint--eval (cadr rx))))
+ ;; For safety, make sure the result isn't another evaluating form.
+ (when (and (consp arg)
+ (memq (car arg) '(literal eval regexp regex)))
+ (throw 'relint-eval 'no-value))
+ arg))
+ ((memq (car rx) '(literal regexp regex))
(let ((arg (relint--eval (cadr rx))))
(if (stringp arg)
(list (car rx) arg)