diff lisp/cl.el @ 5462:97ac18bd1fa3

Make sure distinct symbol macros with identical names expand distinctly. lisp/ChangeLog addition: 2011-04-24 Aidan Kehoe <kehoea@parhasard.net> * cl-macs.el (symbol-macrolet): * cl-macs.el (lexical-let): * cl.el: * cl.el (cl-macroexpand): Distinct symbol macros with identical string names should nonetheless expand to different things; implement this, storing the symbol's eq-hash in the macro environment, rather than its string name. tests/ChangeLog addition: 2011-04-24 Aidan Kehoe <kehoea@parhasard.net> * automated/lisp-tests.el: Check that distinct symbol macros with identical string names expand to different things.
author Aidan Kehoe <kehoea@parhasard.net>
date Sun, 24 Apr 2011 09:52:45 +0100
parents 25c10648ffba
children f2881cb841b4
line wrap: on
line diff
--- a/lisp/cl.el	Sat Apr 23 22:42:10 2011 +0100
+++ b/lisp/cl.el	Sun Apr 24 09:52:45 2011 +0100
@@ -229,11 +229,17 @@
 
 The second optional arg ENVIRONMENT specifies an environment of macro
 definitions to shadow the loaded ones for use in file byte-compilation."
-  (let ((cl-macro-environment cl-env))
-    (while (progn (setq cl-macro (funcall cl-old-macroexpand cl-macro cl-env))
+  (let ((cl-macro-environment
+	 (if cl-macro-environment (append cl-env cl-macro-environment) cl-env))
+	eq-hash)
+    (while (progn (setq cl-macro
+			(macroexpand-internal cl-macro cl-macro-environment))
 		  (and (symbolp cl-macro)
-		       (cdr (assq (symbol-name cl-macro) cl-env))))
-      (setq cl-macro (cadr (assq (symbol-name cl-macro) cl-env))))
+		       (setq eq-hash (eq-hash cl-macro))
+		       (if (fixnump eq-hash)
+			   (assq eq-hash cl-macro-environment)
+			 (assoc eq-hash cl-macro-environment))))
+      (setq cl-macro (cadr (assoc* eq-hash cl-macro-environment))))
     cl-macro))
 
 ;;; Declarations.