summaryrefslogtreecommitdiff
path: root/lisp/custom.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/custom.el')
-rw-r--r--lisp/custom.el14
1 files changed, 14 insertions, 0 deletions
diff --git a/lisp/custom.el b/lisp/custom.el
index 2b7621229d9..bbbe70c5ea8 100644
--- a/lisp/custom.el
+++ b/lisp/custom.el
@@ -90,6 +90,20 @@ The value is either the symbol's current value
(as obtained using the `:get' function), if any,
or the value in the symbol's `saved-value' property if any,
or (last of all) the value of EXP."
+ ;; If this value has been set with `setopt' (for instance in
+ ;; ~/.emacs), we didn't necessarily know the type of the user option
+ ;; then. So check now, and issue a warning if it's wrong.
+ (let ((value (get symbol 'custom-check-value)))
+ (when value
+ (let ((type (get symbol 'custom-type)))
+ (when (and type
+ (boundp symbol)
+ (eq (car value) (symbol-value symbol))
+ ;; Check that the type is correct.
+ (not (widget-apply (widget-convert type)
+ :match (car value))))
+ (warn "Value `%S' for `%s' does not match type %s"
+ value symbol type)))))
(funcall (or (get symbol 'custom-set) #'set-default-toplevel-value)
symbol
(condition-case nil