Function: make-interpreted-closure

make-interpreted-closure is a function defined in eval.c.

Signature

(make-interpreted-closure ARGS BODY ENV &optional DOCSTRING IFORM)

Documentation

Make an interpreted closure.

ARGS should be the list of formal arguments. BODY should be a non-empty list of forms. ENV should be a lexical environment, like the second argument of eval. IFORM if non-nil should be of the form (interactive ...).

View in manual

Probably introduced at or before Emacs version 30.1.

Source Code

// Defined in /usr/src/emacs/src/eval.c
{
  Lisp_Object ifcdr, value, slots[6];

  CHECK_CONS (body);          /* Make sure it's not confused with byte-code! */
  CHECK_LIST (args);
  CHECK_LIST (iform);
  ifcdr = CDR (iform);
  if (NILP (CDR (ifcdr)))
    value = CAR (ifcdr);
  else
    value = CALLN (Fvector, XCAR (ifcdr), XCDR (ifcdr));
  slots[0] = args;
  slots[1] = body;
  slots[2] = env;
  slots[3] = Qnil;
  slots[4] = docstring;
  slots[5] = value;
  /* Adjusting the size is indispensable since, as for byte-code objects,
     we distinguish interactive functions by the presence or absence of the
     iform slot.  */
  Lisp_Object val
    = Fvector (!NILP (iform) ? 6 : !NILP (docstring) ? 5 : 3, slots);
  XSETPVECTYPE (XVECTOR (val), PVEC_CLOSURE);
  return val;
}