comparison tests/automated/lisp-tests.el @ 5658:289cf21be887

Don't augment ENVIRONMENT when that's not indicated, #'macroexpand. This reflects better understanding on my part of the &environment macro keyword, and I've expanded the Lisp manual and docstrings to reflect that. lisp/ChangeLog addition: 2012-05-06 Aidan Kehoe <kehoea@parhasard.net> * cl-macs.el (block): Comment on why we can't use &environment here. * cl-macs.el (defmacro*): Document &environment in more detail. * cl-macs.el (macrolet): Use &environment, instead of referencing byte-compile-macro-environment directly. * cl-macs.el (symbol-macrolet): Ditto. * cl-macs.el (lexical-let): Ditto. * cl-macs.el (labels): Ditto. man/ChangeLog addition: 2012-05-06 Aidan Kehoe <kehoea@parhasard.net> * lispref/macros.texi (Expansion): Cross-reference to documentation of #'cl-prettyexpand, #'defmacro* when talking about #'macroexpand. tests/ChangeLog addition: 2012-05-06 Aidan Kehoe <kehoea@parhasard.net> * automated/lisp-tests.el: Use &environment appropriately in #'macrolet, instead of relying on #'macroexpand to guess what we mean.
author Aidan Kehoe <kehoea@parhasard.net>
date Sun, 06 May 2012 15:29:59 +0100
parents 5bda701e9e7c
children 37479d841681
comparison
equal deleted inserted replaced
5657:2a870a7b86bd 5658:289cf21be887
2955 (macrolet 2955 (macrolet
2956 ((with-first-arguments (&optional form) 2956 ((with-first-arguments (&optional form)
2957 (append form (list 1 [hi there] 40 "this is a string" pi))) 2957 (append form (list 1 [hi there] 40 "this is a string" pi)))
2958 (with-second-arguments (&optional form) 2958 (with-second-arguments (&optional form)
2959 (append form (list pi e ''hello ''there [40 50 60]))) 2959 (append form (list pi e ''hello ''there [40 50 60])))
2960 (with-both-arguments (&optional form) 2960 (with-both-arguments (&optional form &environment env)
2961 (append form 2961 (append form
2962 (macroexpand '(with-first-arguments)) 2962 (macroexpand '(with-first-arguments) env)
2963 (macroexpand '(with-second-arguments))))) 2963 (macroexpand '(with-second-arguments) env))))
2964 2964
2965 (with-temp-buffer 2965 (with-temp-buffer
2966 (Assert 2966 (Assert
2967 (equal 2967 (equal
2968 (mapconcat #'prin1-to-string (with-first-arguments (list)) ", ") 2968 (mapconcat #'prin1-to-string (with-first-arguments (list)) ", ")
2984 (buffer-string)) 2984 (buffer-string))
2985 "checking the buffer contents are as expected at the end.") 2985 "checking the buffer contents are as expected at the end.")
2986 (Assert (not (funcall (intern "eq") #'bookend #'refer-to-bookend)) 2986 (Assert (not (funcall (intern "eq") #'bookend #'refer-to-bookend))
2987 "checking two mutually recursive functions compiled OK")))) 2987 "checking two mutually recursive functions compiled OK"))))
2988 2988
2989 ;; Test macroexpand's handling of the ENVIRONMENT argument. We augmented it
2990 ;; quietly for about four months, and this was incorrect.
2991
2992 (Check-Error
2993 void-variable
2994 (macrolet
2995 ((with-first-arguments (&optional form)
2996 (append form (list 1 [hi there] 40 "this is a string" pi)))
2997 (with-second-arguments (&optional form)
2998 (append form (list pi e ''hello ''there [40 50 60])))
2999 (with-both-arguments (&optional form)
3000 (append form
3001 (macroexpand '(with-first-arguments))
3002 (macroexpand '(with-second-arguments)))))
3003 (with-both-arguments (list))))
3004
2989 ;;; end of lisp-tests.el 3005 ;;; end of lisp-tests.el