branch: master
commit dbafdb904b48e72620f066a5c7cb0a123fc64baa
Author: Artur Malabarba <bruce.connor...@gmail.com>
Commit: Artur Malabarba <bruce.connor...@gmail.com>

    Add validate-mark-safe-local
---
 validate.el |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/validate.el b/validate.el
index 1ded67b..9eebe9a 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

Reply via email to