Per Abrahamsen <abraham(a)dina.kvl.dk> writes:
I'll ask RMS first.
The names (like set-standard) are way out of the custom namespace.
I couldn't think of any other applications than the XEmacs options
file rewrite and alternative interfaces to customize, which RMS didn't
think was enough to warrant an all new API.
So I put the functions within the custom namespace:
;; User options have up to three extra values, which are manipulated
;; using functions similar to `default-value', `default-boundp' and
;; These values are:
;; The standard value for the user option as specified by the
;; package designer in the `defcustom' declaration.
;; The value set by the user through the customize interface in
;; this session.
;; The value saved by the user in any session.
;; These are represented by the symbol properties `standard-value',
;; `customized-value', and `saved-value'. The value of the symbol
;; properties are nil if the symbol hasn't such a property, and a
;; cons-cell otherwise. The car of the cons-cell should be an
;; expression which, when evaluated, will yield the `standard',
;; `customized', or `saved' value. The cdr of the cons-cell is not
;; The use of a cons-cell is to make it possible to distingish `no
;; value' from a nil value.
;; Evaluating the car makes it possible to have the value depend on
;; circumstances. This is particularly useful for the standard value,
;; which may depend on the setting of some other option or the
;; availability of a specific feature.
(defun custom-set-standard (symbol value)
"Set the standard value of SYMBOL to VALUE."
(put symbol 'standard-value (cons (custom-quote value) nil)))
(defun custom-standard-value (symbol)
"The standard value of SYMBOL."
(eval (car (get symbol 'standard-value))))
(defun custom-standard-boundp (symbol)
"Non-nil if SYMBOL has a standard value."
(get symbol 'standard-value))
(defun custom-set-customized (symbol value)
"Set the customized value of SYMBOL to VALUE."
(put symbol 'customized-value (cons (custom-quote value) nil)))
(defun custom-customized-value (symbol)
"The customized value of SYMBOL."
(eval (car (get symbol 'customized-value))))
(defun custom-customized-boundp (symbol)
"Non-nil if SYMBOL has a customized value."
(get symbol 'customized-value))
(defun custom-set-saved (symbol value)
"Set the saved value of SYMBOL to VALUE."
(put symbol 'saved-value (cons (custom-quote value) nil)))
(defun custom-saved-value (symbol)
"The saved value of SYMBOL."
(eval (car (get symbol 'saved-value))))
(defun custom-saved-boundp (symbol)
"Non-nil if SYMBOL has a saved value."
(get symbol 'saved-value))