"Stephen J. Turnbull" <stephen(a)xemacs.org> writes:
>>>>> "jpw" == John Paul Wallington
<jpw(a)shootybangbang.com> writes:
jpw> Sorry, I wasn't paying attention. That isn't a workaround:
jpw> `functionp' is supposed to return nil for a macro.
Right, but the question is "what should functionp return for an
autoload?"
Return T because an autoloaded function is still a function. Our
FUNCTIONP docstring even defines what a function is -- "an object that
can be applied to arguments, using for example `funcall' or `apply'."
Of course, when we know that what we're going to autoload is not a
function, we might as well return NIL immediately. And that's all
Paul is asking for. A patch might look like this (minimally tested):
2002-07-08 Hrvoje Niksic <hniksic(a)xemacs.org>
* eval.c (Ffunctionp): Return nil for autoloaded macros and
keymaps.
--- src/eval.c.orig Mon Jul 8 06:16:34 2002
+++ src/eval.c Mon Jul 8 06:19:38 2002
@@ -3607,13 +3607,18 @@
if (SYMBOLP (object))
object = indirect_function (object, 0);
- return
- (SUBRP (object) ||
- COMPILED_FUNCTIONP (object) ||
- (CONSP (object) &&
- (EQ (XCAR (object), Qlambda) ||
- EQ (XCAR (object), Qautoload))))
- ? Qt : Qnil;
+ if (COMPILED_FUNCTIONP (object) || SUBRP (object))
+ return Qt;
+ if (CONSP (object))
+ {
+ Lisp_Object car = XCAR (object);
+ if (EQ (car, Qlambda))
+ return Qt;
+ if (EQ (car, Qautoload)
+ && NILP (Fcar_safe (Fcdr_safe (Fcdr_safe (Fcdr_safe (XCDR (object)))))))
+ return Qt;
+ }
+ return Qnil;
}
static Lisp_Object