Subject: bug#50944: malformed :safe entry in several defcustoms

From: Glenn Morris <[email-masked]>
Date: Sun, 03 Oct 2021 19:52:45 -0400

Stefan Monnier wrote:

>> Around 30 defcustoms (mostly in Org) state ":safe t", which is incorrect.
>> The safe-local-variable property should be a predicate function of one
>> argument.
>
> The secondary bug here is that those errors should be flagged with
> a warning.

Run-time warning seems easy:

--- a/lisp/files.el
+++ b/lisp/files.el
@@ -4042,7 +4042,7 @@ It is safe if any of these conditions are met:
    evaluates to a non-nil value with VAL as an argument."
   (or (member (cons sym val) safe-local-variable-values)
       (let ((safep (get sym 'safe-local-variable)))
-        (and (functionp safep)
+        (and safep
              ;; If the function signals an error, that means it
              ;; can't assure us that the value is safe.
              (with-demoted-errors (funcall safep val))))))