diff options
Diffstat (limited to 'src/eval.c')
| -rw-r--r-- | src/eval.c | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/src/eval.c b/src/eval.c index 16661378e82..9a03e5fac83 100644 --- a/src/eval.c +++ b/src/eval.c | |||
| @@ -6,7 +6,7 @@ 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, |
| @@ -2050,42 +2050,49 @@ then strings and vectors are not accepted. */) | |||
| 2050 | { | 2050 | { |
| 2051 | register Lisp_Object fun; | 2051 | register Lisp_Object fun; |
| 2052 | register Lisp_Object funcar; | 2052 | register Lisp_Object funcar; |
| 2053 | Lisp_Object if_prop = Qnil; | ||
| 2053 | 2054 | ||
| 2054 | fun = function; | 2055 | fun = function; |
| 2055 | 2056 | ||
| 2056 | fun = indirect_function (fun); | 2057 | fun = indirect_function (fun); /* Check cycles. */ |
| 2057 | if (EQ (fun, Qunbound)) | 2058 | if (NILP (fun) || EQ (fun, Qunbound)) |
| 2058 | return Qnil; | 2059 | return Qnil; |
| 2059 | 2060 | ||
| 2061 | /* Check an `interactive-form' property if present, analogous to the | ||
| 2062 | function-documentation property. */ | ||
| 2063 | fun = function; | ||
| 2064 | while (SYMBOLP (fun)) | ||
| 2065 | { | ||
| 2066 | Lisp_Object tmp = Fget (fun, intern ("interactive-form")); | ||
| 2067 | if (!NILP (tmp)) | ||
| 2068 | if_prop = Qt; | ||
| 2069 | fun = Fsymbol_function (fun); | ||
| 2070 | } | ||
| 2071 | |||
| 2060 | /* Emacs primitives are interactive if their DEFUN specifies an | 2072 | /* Emacs primitives are interactive if their DEFUN specifies an |
| 2061 | interactive spec. */ | 2073 | interactive spec. */ |
| 2062 | if (SUBRP (fun)) | 2074 | if (SUBRP (fun)) |
| 2063 | { | 2075 | return XSUBR (fun)->prompt ? Qt : if_prop; |
| 2064 | if (XSUBR (fun)->prompt) | ||
| 2065 | return Qt; | ||
| 2066 | else | ||
| 2067 | return Qnil; | ||
| 2068 | } | ||
| 2069 | 2076 | ||
| 2070 | /* Bytecode objects are interactive if they are long enough to | 2077 | /* Bytecode objects are interactive if they are long enough to |
| 2071 | have an element whose index is COMPILED_INTERACTIVE, which is | 2078 | have an element whose index is COMPILED_INTERACTIVE, which is |
| 2072 | where the interactive spec is stored. */ | 2079 | where the interactive spec is stored. */ |
| 2073 | else if (COMPILEDP (fun)) | 2080 | else if (COMPILEDP (fun)) |
| 2074 | return ((ASIZE (fun) & PSEUDOVECTOR_SIZE_MASK) > COMPILED_INTERACTIVE | 2081 | return ((ASIZE (fun) & PSEUDOVECTOR_SIZE_MASK) > COMPILED_INTERACTIVE |
| 2075 | ? Qt : Qnil); | 2082 | ? Qt : if_prop); |
| 2076 | 2083 | ||
| 2077 | /* Strings and vectors are keyboard macros. */ | 2084 | /* Strings and vectors are keyboard macros. */ |
| 2078 | if (NILP (for_call_interactively) && (STRINGP (fun) || VECTORP (fun))) | 2085 | if (STRINGP (fun) || VECTORP (fun)) |
| 2079 | return Qt; | 2086 | return NILP (for_call_interactively) ? Qt : Qnil; |
| 2080 | 2087 | ||
| 2081 | /* Lists may represent commands. */ | 2088 | /* Lists may represent commands. */ |
| 2082 | if (!CONSP (fun)) | 2089 | if (!CONSP (fun)) |
| 2083 | return Qnil; | 2090 | return Qnil; |
| 2084 | funcar = XCAR (fun); | 2091 | funcar = XCAR (fun); |
| 2085 | if (EQ (funcar, Qlambda)) | 2092 | if (EQ (funcar, Qlambda)) |
| 2086 | return Fassq (Qinteractive, Fcdr (XCDR (fun))); | 2093 | return !NILP (Fassq (Qinteractive, Fcdr (XCDR (fun)))) ? Qt : if_prop; |
| 2087 | if (EQ (funcar, Qautoload)) | 2094 | if (EQ (funcar, Qautoload)) |
| 2088 | return Fcar (Fcdr (Fcdr (XCDR (fun)))); | 2095 | return !NILP (Fcar (Fcdr (Fcdr (XCDR (fun))))) ? Qt : if_prop; |
| 2089 | else | 2096 | else |
| 2090 | return Qnil; | 2097 | return Qnil; |
| 2091 | } | 2098 | } |