Function: read-command

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

Signature

(read-command PROMPT &optional DEFAULT-VALUE)

Documentation

Read the name of a command and return as a symbol.

Prompt with PROMPT. By default, return DEFAULT-VALUE or its first element if it is a list. If DEFAULT-VALUE is omitted or nil, and the user enters null input, return a symbol whose name is an empty string.

View in manual

Probably introduced at or before Emacs version 20.1.

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, Qcommandp, Qt,
			   Qnil, Qnil, default_string, Qnil);
  if (NILP (name))
    return name;
  return Fintern (name, Qnil);
}