+2011-03-13 Stefan Monnier <monnier@iro.umontreal.ca>
+
+ * help-fns.el (help-function-arglist):
+ * emacs-lisp/bytecomp.el (byte-compile-arglist-warn):
+ * subr.el (apply-partially): Adjust to new format.
+ * emacs-lisp/disass.el (disassemble-internal): Catch closures.
+
2011-03-12 Stefan Monnier <monnier@iro.umontreal.ca>
* subr.el (apply-partially): Move from subr.el; don't use lexical-let.
(let ((sig1 (byte-compile-arglist-signature
(pcase old
(`(lambda ,args . ,_) args)
- (`(closure ,_ ,_ ,args . ,_) args)
+ (`(closure ,_ ,args . ,_) args)
((pred byte-code-function-p) (aref old 0))
(t '(&rest def)))))
(sig2 (byte-compile-arglist-signature (nth 2 form))))
(setq macro t
obj (cdr obj)))
(when (and (listp obj) (eq (car obj) 'closure))
- (setq lexical-binding t)
- (setq obj (cddr obj)))
+ (error "Don't know how to compile an interpreted closure"))
(if (and (listp obj) (eq (car obj) 'byte-code))
(setq obj (list 'lambda nil obj)))
(if (and (listp obj) (not (eq (car obj) 'lambda)))
(if (and (symbolp def) (fboundp def)) (setq def (indirect-function def)))
;; If definition is a macro, find the function inside it.
(if (eq (car-safe def) 'macro) (setq def (cdr def)))
- ;; and do the same for interpreted closures
- (if (eq (car-safe def) 'closure) (setq def (cddr def)))
(cond
((and (byte-code-function-p def) (integerp (aref def 0)))
(let* ((args-desc (aref def 0))
(nreverse arglist)))
((byte-code-function-p def) (aref def 0))
((eq (car-safe def) 'lambda) (nth 1 def))
+ ((eq (car-safe def) 'closure) (nth 2 def))
((subrp def)
(let ((arity (subr-arity def))
(arglist ()))
The result is a new function which does the same as FUN, except that
the first N arguments are fixed at the values with which this function
was called."
- `(closure () lambda (&rest args)
+ `(closure () (&rest args)
(apply ',fun ,@(mapcar (lambda (arg) `',arg) args) args)))
(if (null (featurep 'cl))
+2011-03-13 Stefan Monnier <monnier@iro.umontreal.ca>
+
+ * eval.c (Ffunction): Use simpler format for closures.
+ (Fcommandp, funcall_lambda):
+ * doc.c (Fdocumentation, store_function_docstring):
+ * data.c (Finteractive_form): Adjust to new closure format.
+
2011-03-11 Stefan Monnier <monnier@iro.umontreal.ca>
* eval.c (Fprog1, Fprog2): Simplify and use XCDR/XCAR.
{
Lisp_Object funcar = XCAR (fun);
if (EQ (funcar, Qclosure))
- fun = Fcdr (XCDR (fun)), funcar = Fcar (fun);
- if (EQ (funcar, Qlambda))
+ return Fassq (Qinteractive, Fcdr (Fcdr (XCDR (fun))));
+ else if (EQ (funcar, Qlambda))
return Fassq (Qinteractive, Fcdr (XCDR (fun)));
else if (EQ (funcar, Qautoload))
{
else if (EQ (funcar, Qkeymap))
return build_string ("Prefix command (definition is a keymap associating keystrokes with commands).");
else if (EQ (funcar, Qlambda)
+ || (EQ (funcar, Qclosure) && (fun = XCDR (fun), 1))
|| EQ (funcar, Qautoload))
{
Lisp_Object tem1;
else
return Qnil;
}
- else if (EQ (funcar, Qclosure))
- return Fdocumentation (Fcdr (XCDR (fun)), raw);
else if (EQ (funcar, Qmacro))
return Fdocumentation (Fcdr (fun), raw);
else
Lisp_Object tem;
tem = XCAR (fun);
- if (EQ (tem, Qlambda) || EQ (tem, Qautoload))
+ if (EQ (tem, Qlambda) || EQ (tem, Qautoload)
+ || (EQ (tem, Qclosure) && (fun = XCDR (fun), 1)))
{
tem = Fcdr (Fcdr (fun));
if (CONSP (tem) && INTEGERP (XCAR (tem)))
}
else if (EQ (tem, Qmacro))
store_function_docstring (XCDR (fun), offset);
- else if (EQ (tem, Qclosure))
- store_function_docstring (Fcdr (XCDR (fun)), offset);
}
/* Bytecode objects sometimes have slots for it. */
&& EQ (XCAR (quoted), Qlambda))
/* This is a lambda expression within a lexical environment;
return an interpreted closure instead of a simple lambda. */
- return Fcons (Qclosure, Fcons (Vinternal_interpreter_environment, quoted));
+ return Fcons (Qclosure, Fcons (Vinternal_interpreter_environment,
+ XCDR (quoted)));
else
/* Simply quote the argument. */
return quoted;
return Qnil;
funcar = XCAR (fun);
if (EQ (funcar, Qclosure))
- fun = Fcdr (XCDR (fun)), funcar = Fcar (fun);
- if (EQ (funcar, Qlambda))
+ return !NILP (Fassq (Qinteractive, Fcdr (Fcdr (XCDR (fun))))) ? Qt : if_prop;
+ else if (EQ (funcar, Qlambda))
return !NILP (Fassq (Qinteractive, Fcdr (XCDR (fun)))) ? Qt : if_prop;
else if (EQ (funcar, Qautoload))
return !NILP (Fcar (Fcdr (Fcdr (XCDR (fun))))) ? Qt : if_prop;
{
fun = XCDR (fun); /* Drop `closure'. */
lexenv = XCAR (fun);
- fun = XCDR (fun); /* Drop the lexical environment. */
+ CHECK_LIST_CONS (fun, fun);
}
else
lexenv = Qnil;