# HG changeset patch # User Aidan Kehoe # Date 1320256239 0 # Node ID 4218b56833b3762e4226b0321fca51f4f1422df8 # Parent 2dbefd79b3d3713ac08021ff1a8ce6efd034d607 Give the label name when warning or erroring, bytecomp.el 2011-11-02 Aidan Kehoe * bytecomp.el (byte-compile-lambda): Accept a new NAME argument here, have byte-compile-current-form reflect that if it's specified. * bytecomp.el (byte-compile-initial-macro-environment): Specify the label name when byte-compiling it, so warning and errors are more helpful. diff -r 2dbefd79b3d3 -r 4218b56833b3 lisp/ChangeLog --- a/lisp/ChangeLog Sat Oct 29 01:10:32 2011 +0900 +++ b/lisp/ChangeLog Wed Nov 02 17:50:39 2011 +0000 @@ -1,3 +1,12 @@ +2011-11-02 Aidan Kehoe + + * bytecomp.el (byte-compile-lambda): + Accept a new NAME argument here, have byte-compile-current-form + reflect that if it's specified. + * bytecomp.el (byte-compile-initial-macro-environment): + Specify the label name when byte-compiling it, so warning and + errors are more helpful. + 2011-10-17 Aidan Kehoe * startup.el (load-terminal-library): diff -r 2dbefd79b3d3 -r 4218b56833b3 lisp/bytecomp.el --- a/lisp/bytecomp.el Sat Oct 29 01:10:32 2011 +0900 +++ b/lisp/bytecomp.el Wed Nov 02 17:50:39 2011 +0000 @@ -563,24 +563,25 @@ 'byte-optimizer) 'byte-compile-inline-expand) `(((function ,placeholder) - ,(byte-compile-lambda lambda) + ,(byte-compile-lambda lambda name) (function ,lambda))))) names placeholders lambdas)) (compiled - (mapcar #'byte-compile-lambda - (if (not inline) - lambdas - ;; See further down for the + (mapcar* #'byte-compile-lambda + (if (not inline) + lambdas + ;; See further down for the ;; rationale of the sublis calls. - (sublis (pairlis - (mapcar #'cadar inline) - (mapcar #'third inline)) - (sublis - (pairlis - (mapcar #'car inline) - (mapcar #'second inline)) - lambdas :test #'equal) - :test #'eq)))) + (sublis (pairlis + (mapcar #'cadar inline) + (mapcar #'third inline)) + (sublis + (pairlis + (mapcar #'car inline) + (mapcar #'second inline)) + lambdas :test #'equal) + :test #'eq)) + names)) elt) (mapc #'(lambda (placeholder function) (nsubst function placeholder compiled @@ -2736,10 +2737,11 @@ ;; Byte-compile a lambda-expression and return a valid function. ;; The value is usually a compiled function but may be the original ;; lambda-expression. -(defun byte-compile-lambda (fun) +(defun byte-compile-lambda (fun &optional name) (or (eq 'lambda (car-safe fun)) (error "not a lambda -- %s" (prin1-to-string fun))) - (let* ((arglist (nth 1 fun)) + (let* ((byte-compile-current-form (or name byte-compile-current-form)) + (arglist (nth 1 fun)) (byte-compile-bound-variables (let ((new-bindings (mapcar #'(lambda (x) (cons x byte-compile-arglist-bit))