From: Artur Malabarba Date: Wed, 4 May 2016 15:27:15 +0000 (-0300) Subject: Merge commit '3659f0267f1a70a7141b7d53d8a0696d40247c08' X-Git-Url: https://code.delx.au/gnu-emacs-elpa/commitdiff_plain/cb2d5b29dbdf0aab7f4804438e53bfa1a4dcd82d?hp=-c Merge commit '3659f0267f1a70a7141b7d53d8a0696d40247c08' --- cb2d5b29dbdf0aab7f4804438e53bfa1a4dcd82d diff --combined packages/validate/validate.el index 8408b63c3,7dfe45b01..7dfe45b01 --- a/packages/validate/validate.el +++ b/packages/validate/validate.el @@@ -5,7 -5,7 +5,7 @@@ ;; Author: Artur Malabarba ;; Keywords: lisp ;; Package-Requires: ((emacs "24.1") (cl-lib "0.5")) - ;; Version: 0.2 + ;; Version: 0.3 ;;; Commentary: ;; @@@ -182,5 -182,10 +182,10 @@@ with `validate-value'. NOERROR is passe (lambda (val) (validate-value val (custom-variable-type symbol) 'noerror)))) + (defmacro validate-setq (symbol value) + "Like `setq', but throw an error if validation fails. + VALUE is validated against SYMBOL's custom type." + `(setq ,symbol (validate-value ,value (custom-variable-type ',symbol)))) + (provide 'validate) ;;; validate.el ends here