emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/relint cf39690 3/9: Clean-ups and safety fixes


From: Mattias Engdegård
Subject: [elpa] externals/relint cf39690 3/9: Clean-ups and safety fixes
Date: Sat, 13 Apr 2019 12:51:29 -0400 (EDT)

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

    Clean-ups and safety fixes
    
    Require cl-lib instead of cl-seq, as suggested by Stefan Monnier.
    
    Remove some functions with function args from relint--safe-functions.
    Make one of them (alist-get) work by wrapping its function argument.
---
 relint.el | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/relint.el b/relint.el
index 4db34d5..17b8be4 100644
--- a/relint.el
+++ b/relint.el
@@ -75,7 +75,7 @@
 
 (require 'xr)
 (require 'compile)
-(require 'cl-seq)
+(require 'cl-lib)
 
 (defconst relint--error-buffer-name "*relint*")
 
@@ -223,7 +223,7 @@
     eq eql equal
     string-equal string= string< string-lessp string> string-greaterp
     char-equal string-match-p
-    string-match split-string replace-regexp-in-string
+    string-match split-string
     wildcard-to-regexp
     combine-and-quote-strings split-string-and-unquote
     string-to-multibyte string-as-multibyte string-to-unibyte string-as-unibyte
@@ -236,7 +236,7 @@
     string-to-list string-to-vector string-or-null-p
     upcase downcase capitalize
     purecopy copy-sequence copy-alist copy-tree
-    assoc-default member-ignore-case alist-get
+    member-ignore-case
     last butlast number-sequence
     plist-get plist-member
     1value
@@ -417,6 +417,17 @@
             (apply (car form) args)
           (error (throw 'relint-eval 'no-value))))))
 
+   ;; alist-get: wrap the optional fifth argument (testfn).
+   ((eq (car form) 'alist-get)
+    (let* ((all-args (mapcar #'relint--eval (cdr form)))
+           (args (if (< (length all-args) 5)
+                     all-args
+                   (append (butlast all-args (- (length all-args) 4))
+                           (list (relint--wrap-function (nth 4 all-args)))))))
+      (condition-case nil
+          (apply (car form) args)
+        (error (throw 'relint-eval 'no-value)))))
+
    ((eq (car form) 'if)
     (let ((condition (relint--eval (cadr form))))
       (let ((then-part (nth 2 form))



reply via email to

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