Commit 52b71f49 authored by Stefan Monnier's avatar Stefan Monnier
Browse files

(Fcommandp): Pay attention to the `interactive-form' property.

parent c4f46926
...@@ -2040,42 +2040,49 @@ then strings and vectors are not accepted. */) ...@@ -2040,42 +2040,49 @@ then strings and vectors are not accepted. */)
{ {
register Lisp_Object fun; register Lisp_Object fun;
register Lisp_Object funcar; register Lisp_Object funcar;
Lisp_Object if_prop = Qnil;
fun = function; fun = function;
fun = indirect_function (fun); fun = indirect_function (fun); /* Check cycles. */
if (EQ (fun, Qunbound)) if (NILP (fun) || EQ (fun, Qunbound))
return Qnil; return Qnil;
/* Check an `interactive-form' property if present, analogous to the
function-documentation property. */
fun = function;
while (SYMBOLP (fun))
{
Lisp_Object tmp = Fget (fun, intern ("interactive-form"));
if (!NILP (tmp))
if_prop = Qt;
fun = Fsymbol_function (fun);
}
/* Emacs primitives are interactive if their DEFUN specifies an /* Emacs primitives are interactive if their DEFUN specifies an
interactive spec. */ interactive spec. */
if (SUBRP (fun)) if (SUBRP (fun))
{ return XSUBR (fun)->prompt ? Qt : if_prop;
if (XSUBR (fun)->prompt)
return Qt;
else
return Qnil;
}
/* Bytecode objects are interactive if they are long enough to /* Bytecode objects are interactive if they are long enough to
have an element whose index is COMPILED_INTERACTIVE, which is have an element whose index is COMPILED_INTERACTIVE, which is
where the interactive spec is stored. */ where the interactive spec is stored. */
else if (COMPILEDP (fun)) else if (COMPILEDP (fun))
return ((ASIZE (fun) & PSEUDOVECTOR_SIZE_MASK) > COMPILED_INTERACTIVE return ((ASIZE (fun) & PSEUDOVECTOR_SIZE_MASK) > COMPILED_INTERACTIVE
? Qt : Qnil); ? Qt : if_prop);
/* Strings and vectors are keyboard macros. */ /* Strings and vectors are keyboard macros. */
if (NILP (for_call_interactively) && (STRINGP (fun) || VECTORP (fun))) if (STRINGP (fun) || VECTORP (fun))
return Qt; return NILP (for_call_interactively) ? Qt : Qnil;
/* Lists may represent commands. */ /* Lists may represent commands. */
if (!CONSP (fun)) if (!CONSP (fun))
return Qnil; return Qnil;
funcar = XCAR (fun); funcar = XCAR (fun);
if (EQ (funcar, Qlambda)) if (EQ (funcar, Qlambda))
return Fassq (Qinteractive, Fcdr (XCDR (fun))); return !NILP (Fassq (Qinteractive, Fcdr (XCDR (fun)))) ? Qt : if_prop;
if (EQ (funcar, Qautoload)) if (EQ (funcar, Qautoload))
return Fcar (Fcdr (Fcdr (XCDR (fun)))); return !NILP (Fcar (Fcdr (Fcdr (XCDR (fun))))) ? Qt : if_prop;
else else
return Qnil; return Qnil;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment