Function: custom-prompt-variable
custom-prompt-variable is a byte-compiled function defined in
cus-edit.el.gz.
Signature
(custom-prompt-variable PROMPT-VAR PROMPT-VAL &optional COMMENT)
Documentation
Prompt for a variable and a value and return them as a list.
PROMPT-VAR is the prompt for the variable, and PROMPT-VAL is the prompt for the value. The %s escape in PROMPT-VAL is replaced with the name of the variable.
If the variable has a variable-interactive property, that is used as if
it were the arg to interactive (which see) to interactively read the value.
If the variable has a custom-type property, it must be a widget and the
:prompt-value property of that widget will be used for reading the value.
If the variable also has a custom-get property, that is used for finding
the current value of the variable, otherwise symbol-value is used.
If optional COMMENT argument is non-nil, also prompt for a comment and return it as the third element in the list.
Source Code
;; Defined in /usr/src/emacs/lisp/cus-edit.el.gz
;;; The Customize Commands
(defun custom-prompt-variable (prompt-var prompt-val &optional comment)
"Prompt for a variable and a value and return them as a list.
PROMPT-VAR is the prompt for the variable, and PROMPT-VAL is the
prompt for the value. The %s escape in PROMPT-VAL is replaced with
the name of the variable.
If the variable has a `variable-interactive' property, that is used as if
it were the arg to `interactive' (which see) to interactively read the value.
If the variable has a `custom-type' property, it must be a widget and the
`:prompt-value' property of that widget will be used for reading the value.
If the variable also has a `custom-get' property, that is used for finding
the current value of the variable, otherwise `symbol-value' is used.
If optional COMMENT argument is non-nil, also prompt for a comment and return
it as the third element in the list."
(let* ((var (read-variable prompt-var))
(minibuffer-help-form `(describe-variable ',var))
(val
(let ((prop (get var 'variable-interactive))
(type (get var 'custom-type))
(prompt (format prompt-val var)))
(unless (listp type)
(setq type (list type)))
(cond (prop
;; Use VAR's `variable-interactive' property
;; as an interactive spec for prompting.
(call-interactively `(lambda (arg)
(interactive ,prop)
arg)))
(type
(widget-prompt-value type
prompt
(if (boundp var)
(funcall
(or (get var 'custom-get) 'symbol-value)
var))
(not (boundp var))))
(t
(eval-minibuffer prompt))))))
(if comment
(list var val
(read-string "Comment: " (get var 'variable-comment)))
(list var val))))