[Top][All Lists]

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

[elpa] externals/relint 2d1f488 32/44: mapcar on non-list sequence

From: Mattias Engdegård
Subject: [elpa] externals/relint 2d1f488 32/44: mapcar on non-list sequence
Date: Tue, 26 Mar 2019 12:57:29 -0400 (EDT)

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

    mapcar on non-list sequence
    Allow mapcar and mapcan to be run on any sequence that we can evaluate
    statically, not just lists. In particular, mapcar on strings to
    produce a regexp has been observed in the wild, and relint crashed
    without this change.
 relint.el | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/relint.el b/relint.el
index 3d67093..e1d9c27 100644
--- a/relint.el
+++ b/relint.el
@@ -399,8 +399,11 @@
    ;; The sequence argument may be missing a few arguments that we cannot
    ;; evaluate.
    ((memq (car form) '(mapcar mapcan))
-    (let ((fun (relint--safe-function (relint--eval (cadr form)) nil))
-          (seq (remq nil (relint--eval-list (caddr form)))))
+    (let* ((fun (relint--safe-function (relint--eval (cadr form)) nil))
+           (arg (relint--eval-list (caddr form)))
+           (seq (if (listp arg)
+                    (delq nil arg)
+                  arg)))
       (if fun
           (condition-case err
               (funcall (car form) fun seq)

reply via email to

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