Luke Gorrie luke@synap.se writes:
Antonio Menezes Leitao aml@gia.ist.utl.pt writes:
... and I wonder if the macroexpand could bind *print-circle* to nil so that the macroexpansion command does not show a sexp full of #n= and #n# that I find harder to understand. OTOH, it allows us to see structure sharing in the code but that doesn't seem to be terribly useful...
You can do something like this:
(setf (cdr (assoc '*print-circle* swank:*swank-pprint-bindings*)) nil)
I haven't noticed #n# problems with CMUCL but I don't macroexpand all that often.
But that would affect all output. I've been using the following patch:
Index: swank.lisp =================================================================== RCS file: /project/slime/cvsroot/slime/swank.lisp,v retrieving revision 1.286 diff -u -r1.286 swank.lisp --- swank.lisp 12 Mar 2005 16:02:04 -0000 1.286 +++ swank.lisp 13 Mar 2005 12:24:08 -0000 @@ -2138,7 +2138,9 @@ (defun apply-macro-expander (expander string) (declare (type function expander)) (with-buffer-syntax () - (swank-pprint (list (funcall expander (from-string string)))))) + (let ((*swank-pprint-bindings* + `(,@*swank-pprint-bindings* (*print-circle* . nil)))) + (swank-pprint (list (funcall expander (from-string string)))))))
(defslimefun swank-macroexpand-1 (string) (apply-macro-expander #'macroexpand-1 string))
Given the fact that *swank-pprint-bindings* is an alist, it would be better to just rebind *swank-pprint-bindings* with (acons '*print-circle* 'nil *swank-pprint-bindings*) but that would only work if call-with-bindings reversed the alist before the progv.
António Leitão.