Function: read-variable

read-variable is a function defined in minibuf.c.

Signature

(read-variable PROMPT &optional DEFAULT-VALUE)

Documentation

Read the name of a user option and return it as a symbol.

Prompt with PROMPT. By default, return DEFAULT-VALUE or its first element if it is a list of strings. A user option, or customizable variable, is one for which custom-variable-p returns non-nil.

View in manual

Probably introduced at or before Emacs version 17.

Source Code

// Defined in /usr/src/emacs/src/minibuf.c
{
  Lisp_Object name, default_string;

  if (NILP (default_value))
    default_string = Qnil;
  else if (SYMBOLP (default_value))
    default_string = SYMBOL_NAME (default_value);
  else
    default_string = default_value;

  name = Fcompleting_read (prompt, Vobarray,
			   Qcustom_variable_p, Qt,
			   Qnil, Qcustom_variable_history,
			   default_string, Qnil);
  if (NILP (name))
    return name;
  return Fintern (name, Qnil);
}