[Top][All Lists]

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

[elpa] externals/relint 6a07508 10/23: Handle rx `eval' form correctly

From: Mattias Engdegård
Subject: [elpa] externals/relint 6a07508 10/23: Handle rx `eval' form correctly
Date: Sun, 29 Sep 2019 15:34:52 -0400 (EDT)

branch: externals/relint
commit 6a07508cc257227028d285f971d39fa4aea22283
Author: Mattias Engdegård <address@hidden>
Commit: Mattias Engdegård <address@hidden>

    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.")
    ;; 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)

reply via email to

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