aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorStefan Monnier2007-07-25 21:03:31 +0000
committerStefan Monnier2007-07-25 21:03:31 +0000
commit52b71f49ad26e3ef1a44ec313f3ad6278f5ebc27 (patch)
tree2a5aad03274754ed7bd219d600b120407adf8611 /src
parentc4f46926ae2af8e668c3995eb4fec74bcc83b9ef (diff)
downloademacs-52b71f49ad26e3ef1a44ec313f3ad6278f5ebc27.tar.gz
emacs-52b71f49ad26e3ef1a44ec313f3ad6278f5ebc27.zip
(Fcommandp): Pay attention to the `interactive-form' property.
Diffstat (limited to 'src')
-rw-r--r--src/eval.c33
1 files changed, 20 insertions, 13 deletions
diff --git a/src/eval.c b/src/eval.c
index 7d7e73484f7..dd51270285b 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -2040,42 +2040,49 @@ then strings and vectors are not accepted. */)
2040{ 2040{
2041 register Lisp_Object fun; 2041 register Lisp_Object fun;
2042 register Lisp_Object funcar; 2042 register Lisp_Object funcar;
2043 Lisp_Object if_prop = Qnil;
2043 2044
2044 fun = function; 2045 fun = function;
2045 2046
2046 fun = indirect_function (fun); 2047 fun = indirect_function (fun); /* Check cycles. */
2047 if (EQ (fun, Qunbound)) 2048 if (NILP (fun) || EQ (fun, Qunbound))
2048 return Qnil; 2049 return Qnil;
2049 2050
2051 /* Check an `interactive-form' property if present, analogous to the
2052 function-documentation property. */
2053 fun = function;
2054 while (SYMBOLP (fun))
2055 {
2056 Lisp_Object tmp = Fget (fun, intern ("interactive-form"));
2057 if (!NILP (tmp))
2058 if_prop = Qt;
2059 fun = Fsymbol_function (fun);
2060 }
2061
2050 /* Emacs primitives are interactive if their DEFUN specifies an 2062 /* Emacs primitives are interactive if their DEFUN specifies an
2051 interactive spec. */ 2063 interactive spec. */
2052 if (SUBRP (fun)) 2064 if (SUBRP (fun))
2053 { 2065 return XSUBR (fun)->prompt ? Qt : if_prop;
2054 if (XSUBR (fun)->prompt)
2055 return Qt;
2056 else
2057 return Qnil;
2058 }
2059 2066
2060 /* Bytecode objects are interactive if they are long enough to 2067 /* Bytecode objects are interactive if they are long enough to
2061 have an element whose index is COMPILED_INTERACTIVE, which is 2068 have an element whose index is COMPILED_INTERACTIVE, which is
2062 where the interactive spec is stored. */ 2069 where the interactive spec is stored. */
2063 else if (COMPILEDP (fun)) 2070 else if (COMPILEDP (fun))
2064 return ((ASIZE (fun) & PSEUDOVECTOR_SIZE_MASK) > COMPILED_INTERACTIVE 2071 return ((ASIZE (fun) & PSEUDOVECTOR_SIZE_MASK) > COMPILED_INTERACTIVE
2065 ? Qt : Qnil); 2072 ? Qt : if_prop);
2066 2073
2067 /* Strings and vectors are keyboard macros. */ 2074 /* Strings and vectors are keyboard macros. */
2068 if (NILP (for_call_interactively) && (STRINGP (fun) || VECTORP (fun))) 2075 if (STRINGP (fun) || VECTORP (fun))
2069 return Qt; 2076 return NILP (for_call_interactively) ? Qt : Qnil;
2070 2077
2071 /* Lists may represent commands. */ 2078 /* Lists may represent commands. */
2072 if (!CONSP (fun)) 2079 if (!CONSP (fun))
2073 return Qnil; 2080 return Qnil;
2074 funcar = XCAR (fun); 2081 funcar = XCAR (fun);
2075 if (EQ (funcar, Qlambda)) 2082 if (EQ (funcar, Qlambda))
2076 return Fassq (Qinteractive, Fcdr (XCDR (fun))); 2083 return !NILP (Fassq (Qinteractive, Fcdr (XCDR (fun)))) ? Qt : if_prop;
2077 if (EQ (funcar, Qautoload)) 2084 if (EQ (funcar, Qautoload))
2078 return Fcar (Fcdr (Fcdr (XCDR (fun)))); 2085 return !NILP (Fcar (Fcdr (Fcdr (XCDR (fun))))) ? Qt : if_prop;
2079 else 2086 else
2080 return Qnil; 2087 return Qnil;
2081} 2088}