r9078: add ppmx
authorKevin M. Rosenberg <kevin@rosenberg.net>
Sun, 18 Apr 2004 23:11:52 +0000 (23:11 +0000)
committerKevin M. Rosenberg <kevin@rosenberg.net>
Sun, 18 Apr 2004 23:11:52 +0000 (23:11 +0000)
macros.lisp
package.lisp

index 9b6150a470dc9597470fe8ad2ba8e303e9c3e853..bf2714b86d441eec6f9d0c4bbce5a64f7f539d73 100644 (file)
      ,@(mapcar
        (lambda (x) (list 'ignore-errors x))
        forms)))
+
+(defmacro ppmx (form)
+  "Pretty prints the macro expansion of FORM."
+  `(let* ((exp1 (macroexpand-1 ',form))
+         (exp (macroexpand exp1))
+         (*print-circle* nil))
+     (cond ((equal exp exp1)
+           (format t "~&Macro expansion:")
+           (pprint exp))
+          (t (format t "~&First step of expansion:")
+             (pprint exp1)
+             (format t "~%~%Final expansion:")
+             (pprint exp)))
+     (format t "~%~%")
+     (values)))
index b04ab8e50f18c16a28ab0990d24ce7aa4e136801..3d442662816cd43c9e956f89c9985f06507fc6c1 100644 (file)
    #:def-cached-vector
    #:def-cached-instance
    #:with-ignore-errors
-   
+   #:ppmx
+
    ;; files.lisp
    #:print-file-contents
    #:read-stream-to-string