Commit e1f29348 authored by Barry O'Reilly's avatar Barry O'Reilly Committed by Stefan Monnier

* src/lisp.h (functionp): New function (extracted from Ffunctionp).

(FUNCTIONP): Use it.
* src/eval.c (Ffunctionp): Use it.
parent 4c47bd1e
2012-08-26 Barry OReilly <gundaetiapo@gmail.com> (tiny change)
* lisp.h (functionp): New function (extracted from Ffunctionp).
(FUNCTIONP): Use it.
* eval.c (Ffunctionp): Use it.
2012-08-25 Paul Eggert <eggert@cs.ucla.edu>
* xgselect.c (xg_select): Use auto storage for the GPollFD buffer
......@@ -160,8 +166,8 @@
* w32uniscribe.c (uniscribe_shape): Fix producing gstring
components for RTL text (Bug#11860). Adjust X-OFFSET of each
non-base glyph for the width of the base character, according to
what x_draw_composite_glyph_string_foreground expects. Generate
WADJUST value according to composition_gstring_width's
what x_draw_composite_glyph_string_foreground expects.
Generate WADJUST value according to composition_gstring_width's
expectations, to produce correct width of the composed character.
Reverse the sign of the DU offset produced by ScriptPlace.
......
......@@ -2722,33 +2722,9 @@ DEFUN ("functionp", Ffunctionp, Sfunctionp, 1, 1, 0,
doc: /* Non-nil if OBJECT is a function. */)
(Lisp_Object object)
{
if (SYMBOLP (object) && !NILP (Ffboundp (object)))
{
object = Findirect_function (object, Qt);
if (CONSP (object) && EQ (XCAR (object), Qautoload))
{
/* Autoloaded symbols are functions, except if they load
macros or keymaps. */
int i;
for (i = 0; i < 4 && CONSP (object); i++)
object = XCDR (object);
return (CONSP (object) && !NILP (XCAR (object))) ? Qnil : Qt;
}
}
if (SUBRP (object))
return (XSUBR (object)->max_args != UNEVALLED) ? Qt : Qnil;
else if (COMPILEDP (object))
if (FUNCTIONP (object))
return Qt;
else if (CONSP (object))
{
Lisp_Object car = XCAR (object);
return (EQ (car, Qlambda) || EQ (car, Qclosure)) ? Qt : Qnil;
}
else
return Qnil;
return Qnil;
}
DEFUN ("funcall", Ffuncall, Sfuncall, 1, MANY, 0,
......
......@@ -1906,11 +1906,7 @@ typedef struct {
Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object)
/* Non-zero if OBJ is a Lisp function. */
#define FUNCTIONP(OBJ) \
((CONSP (OBJ) && EQ (XCAR (OBJ), Qlambda)) \
|| (SYMBOLP (OBJ) && !NILP (Ffboundp (OBJ))) \
|| COMPILEDP (OBJ) \
|| SUBRP (OBJ))
#define FUNCTIONP(OBJ) functionp(OBJ)
/* defsubr (Sname);
is how we define the symbol for function `name' at start-up time. */
......@@ -3656,6 +3652,38 @@ maybe_gc (void)
Fgarbage_collect ();
}
LISP_INLINE int
functionp (Lisp_Object object)
{
if (SYMBOLP (object) && !NILP (Ffboundp (object)))
{
object = Findirect_function (object, Qt);
if (CONSP (object) && EQ (XCAR (object), Qautoload))
{
/* Autoloaded symbols are functions, except if they load
macros or keymaps. */
int i;
for (i = 0; i < 4 && CONSP (object); i++)
object = XCDR (object);
return ! (CONSP (object) && !NILP (XCAR (object)));
}
}
if (SUBRP (object))
return XSUBR (object)->max_args != UNEVALLED;
else if (COMPILEDP (object))
return 1;
else if (CONSP (object))
{
Lisp_Object car = XCAR (object);
return EQ (car, Qlambda) || EQ (car, Qclosure);
}
else
return 0;
}
INLINE_HEADER_END
#endif /* EMACS_LISP_H */
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