From ccf6f0b53da11a274922ea44718a958b9cd26fb3 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Mon, 26 Apr 2021 20:00:41 -0400 Subject: [PATCH] Log unsafe eval forms in file/dir local variables --- modules/lang/emacs-lisp/config.el | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/lang/emacs-lisp/config.el b/modules/lang/emacs-lisp/config.el index 59b2fd241..c9126fba5 100644 --- a/modules/lang/emacs-lisp/config.el +++ b/modules/lang/emacs-lisp/config.el @@ -37,7 +37,11 @@ employed so that flycheck still does *some* helpful linting.") (pcase-dolist (`(,var . ,val) variables) (cond ((memq var ignored-local-variables)) ((memq var '(mode unibyte coding))) - ((eq var 'eval)) + ((eq var 'eval) + (and enable-local-eval + (not (or (hack-one-local-variable-eval-safep val) + (safe-local-variable-p var val))) + (message "Ignoring unsafe form in file local variable: %S" val))) ((not (safe-local-variable-p var val)) (message "Ignoring unsafe file local variable: %S" var)) ((risky-local-variable-p var val)