}
DEFUN ("call-interactively", Fcall_interactively, Scall_interactively, 1, 3, 0,
- doc: /* Call FUNCTION, providing args according to its interactive calling specs.
-Return the value FUNCTION returns.
-The function contains a specification of how to do the argument reading.
-In the case of user-defined functions, this is specified by placing a call
-to the function `interactive' at the top level of the function body.
-See `interactive'.
+ doc: /* Call COMMAND, as if the user invoked it interactively.
-Optional second arg RECORD-FLAG non-nil
-means unconditionally put this command in the variable `command-history'.
-Otherwise, this is done only if an arg is read using the minibuffer.
+Provide arguments to COMMAND according to its interactive calling
+specs, and return the value COMMAND returns.
+
+Prefer calling COMMAND directly instead of using this function if
+possible, such as when COMMAND is a constant function name and its
+interactive calling spec is not too complex.
+
+Optional second arg RECORD-FLAG non-nil means unconditionally put this
+command in the variable `command-history'. Otherwise, this is done only
+if an arg is read using the minibuffer.
Optional third arg KEYS, if given, specifies the sequence of events to
-supply, as a vector, if FUNCTION inquires which events were used to
+supply, as a vector, if COMMAND inquires which events were used to
invoke it (via an `interactive' spec that contains, for instance, an
\"e\" code letter). If KEYS is omitted or nil, the return value of
-`this-command-keys-vector' is used. */)
- (Lisp_Object function, Lisp_Object record_flag, Lisp_Object keys)
+`this-command-keys-vector' is used.
+
+See also `interactive'. */)
+ (Lisp_Object command, Lisp_Object record_flag, Lisp_Object keys)
{
specpdl_ref speccount = SPECPDL_INDEX ();
Lisp_Object up_event = Qnil;
/* Set SPECS to the interactive form, or barf if not interactive. */
- Lisp_Object form = calln (Qinteractive_form, function);
+ Lisp_Object form = calln (Qinteractive_form, command);
if (! CONSP (form))
- wrong_type_argument (Qcommandp, function);
+ wrong_type_argument (Qcommandp, command);
Lisp_Object specs = Fcar (XCDR (form));
/* At this point the value of SPECS could help provide a way to
/* If SPECS is not a string, invent one. */
if (! STRINGP (specs))
{
- Lisp_Object funval = Findirect_function (function, Qt);
+ Lisp_Object funval = Findirect_function (command, Qt);
uintmax_t events = num_input_events;
Lisp_Object env = CLOSUREP (funval) && CONSP (AREF (funval, CLOSURE_CODE))
? AREF (funval, CLOSURE_CONSTANTS) : Qnil;
Make a copy of the list of values, for the command history,
and turn them into things we can eval. */
Lisp_Object values = quotify_args (Fcopy_sequence (specs));
- fix_command (function, values);
+ fix_command (command, values);
calln (Qadd_to_history, Qcommand_history,
- Fcons (function, values), Qnil, Qt);
+ Fcons (command, values), Qnil, Qt);
}
Vthis_command = save_this_command;
kset_last_command (current_kboard, save_last_command);
return unbind_to (speccount, CALLN (Fapply, Qfuncall_interactively,
- function, specs));
+ command, specs));
}
/* SPECS is set to a string; use it as an interactive prompt.
case 'e': /* The invoking event. */
if (next_event >= key_count)
error ("%s must be bound to an event with parameters",
- (SYMBOLP (function)
- ? SSDATA (SYMBOL_NAME (function))
+ (SYMBOLP (command)
+ ? SSDATA (SYMBOL_NAME (command))
: "command"));
args[i] = AREF (keys, next_event);
varies[i] = -1;
maybe_quit ();
args[0] = Qfuncall_interactively;
- args[1] = function;
+ args[1] = command;
if (arg_from_tty || !NILP (record_flag))
{
/* We don't need `visargs' any more, so let's recycle it since we need
an array of just the same size. */
- visargs[1] = function;
+ visargs[1] = command;
for (ptrdiff_t i = 2; i < nargs; i++)
visargs[i] = (varies[i] > 0
? list1 (intern (callint_argfuns[varies[i]]))