comparison src/eval.c @ 90996:f55f9811f5d7

Merge from emacs--devo--0 Patches applied: * emacs--devo--0 (patch 824-831) - Update from CVS - Merge from emacs--rel--22 * emacs--rel--22 (patch 70-74) - Update from CVS Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-238
author Miles Bader <miles@gnu.org>
date Fri, 27 Jul 2007 10:52:18 +0000
parents 492971a3f31f b98604865ea0
children 424b655804ca
comparison
equal deleted inserted replaced
90995:9a391d85a79f 90996:f55f9811f5d7
4 4
5 This file is part of GNU Emacs. 5 This file is part of GNU Emacs.
6 6
7 GNU Emacs is free software; you can redistribute it and/or modify 7 GNU Emacs is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by 8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option) 9 the Free Software Foundation; either version 3, or (at your option)
10 any later version. 10 any later version.
11 11
12 GNU Emacs is distributed in the hope that it will be useful, 12 GNU Emacs is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2038 (function, for_call_interactively) 2038 (function, for_call_interactively)
2039 Lisp_Object function, for_call_interactively; 2039 Lisp_Object function, for_call_interactively;
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;
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 }
2049 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 }
2082 2089
2083 /* ARGSUSED */ 2090 /* ARGSUSED */