From: Artur Malabarba Date: Wed, 4 May 2016 14:58:38 +0000 (-0300) Subject: Add validate-mark-safe-local X-Git-Url: https://code.delx.au/gnu-emacs-elpa/commitdiff_plain/dbafdb904b48e72620f066a5c7cb0a123fc64baa Add validate-mark-safe-local --- diff --git a/validate.el b/validate.el index 1ded67b0d..9eebe9a36 100644 --- a/validate.el +++ b/validate.el @@ -175,5 +175,12 @@ with `validate-value'. NOERROR is passed to `validate-value'." (if noerror val (error "Variable `%s' has no custom-type." symbol))))) +;;;###autoload +(defun validate-mark-safe-local (symbol) + "Mark SYMBOL as a safe local if its custom type is obeyed." + (put symbol 'safe-local-variable + (lambda (val) + (validate-value val (custom-variable-type symbol) 'noerror)))) + (provide 'validate) ;;; validate.el ends here