Function: custom-variable-state
custom-variable-state is a byte-compiled function defined in
cus-edit.el.gz.
Signature
(custom-variable-state SYMBOL VAL)
Documentation
Return the state of SYMBOL if its value is VAL.
If SYMBOL has a non-nil custom-get property, it overrides VAL.
Possible return values are standard, saved, set, themed,
changed, and rogue.
Source Code
;; Defined in /usr/src/emacs/lisp/cus-edit.el.gz
(defun custom-variable-state (symbol val)
"Return the state of SYMBOL if its value is VAL.
If SYMBOL has a non-nil `custom-get' property, it overrides VAL.
Possible return values are `standard', `saved', `set', `themed',
`changed', and `rogue'."
(let* ((get (or (get symbol 'custom-get) 'default-value))
(value (if (default-boundp symbol)
(funcall get symbol)
val))
(comment (get symbol 'variable-comment))
tmp
temp)
(cond ((progn (setq tmp (get symbol 'customized-value))
(setq temp
(get symbol 'customized-variable-comment))
(or tmp temp))
(if (condition-case nil
(and (equal value (eval (car tmp)))
(equal comment temp))
(error nil))
(if (custom--standard-value-p symbol value)
'standard
'set)
'changed))
((progn (setq tmp (get symbol 'theme-value))
(setq temp (get symbol 'saved-variable-comment))
(or tmp temp))
(if (condition-case nil
(and (equal comment temp)
(equal value
(eval
(car (custom-variable-theme-value
symbol)))))
(error nil))
(cond
((eq (caar tmp) 'user) 'saved)
((eq (caar tmp) 'changed)
(if (condition-case nil
(and (null comment)
(equal value
(eval
(car (get symbol 'standard-value)))))
(error nil))
;; The value was originally set outside
;; custom, but it was set to the standard
;; value (probably an autoloaded defcustom).
'standard
'changed))
(t 'themed))
'changed))
((setq tmp (get symbol 'standard-value))
(if (condition-case nil
(and (equal value (eval (car tmp)))
(equal comment nil))
(error nil))
'standard
'changed))
(t 'rogue))))