Generalize 'scrape-elpa--safe-evil'

* admin/scrape-elpa.el (scrape-elpa--safe-eval): Extend support
from just 'cons' and 'concat' to any side-effect-free function.
This commit is contained in:
Philip Kaludercic 2026-02-11 20:47:26 +01:00
parent 5bc7185afa
commit 0afb026a99
No known key found for this signature in database

View file

@ -43,12 +43,9 @@ be comprehensive, but just to handle the kinds of expressions that
(cons
(if (eq (car-safe car) '\,) (scrape-elpa--safe-eval (cadr car) vars) car)
(if (eq (car-safe cdr) '\,) (scrape-elpa--safe-eval (cadr cdr) vars) cdr)))
;; supported functions
(`(cons ,car ,cdr)
(cons (scrape-elpa--safe-eval car vars)
(scrape-elpa--safe-eval cdr vars)))
(`(concat . ,args)
(apply #'concat (mapcar #'scrape-elpa--safe-eval args)))
;; allow calling `side-effect-free' functions
(`(,(and (pred symbolp) (pred (get _ 'side-effect-free)) fn) . ,args)
(apply fn (mapcar #'scrape-elpa--safe-eval args)))
;; self-evaluating forms
((pred macroexp-const-p) exp)
;; variable evaluation