# HG changeset patch # User Steve Losh # Date 1460244125 0 # Node ID 051685b12e071f7f0fead8e7285f6cb9c0d8bfd1 # Parent 9d3d9514dbd8769c9780c99d189142c9b0efe40c Make macroexpand less ugly on CCL diff -r 9d3d9514dbd8 -r 051685b12e07 src/middleware/macroexpand.lisp --- a/src/middleware/macroexpand.lisp Sat Apr 09 21:59:53 2016 +0000 +++ b/src/middleware/macroexpand.lisp Sat Apr 09 23:22:05 2016 +0000 @@ -1,13 +1,20 @@ (in-package #:nrepl) +(defun pretty-string (form) + "Return a prettified string version of `form`, indented nicely." + #-ccl (format nil "~A" form) + ;; CCL's format doesn't indent forms nicely + #+ccl (with-output-to-string (*standard-output*) + (pprint form))) + (define-middleware wrap-macroexpand "macroexpand" message ;; TODO: handle mangled input (let ((form (read-from-string (fset:lookup message "form")))) (respond message (make-map "status" '("done") - "macroexpand" (format nil "~A" (macroexpand form)) - "macroexpand-1" (format nil "~A" (macroexpand-1 form)))))) + "macroexpand" (pretty-string (macroexpand form)) + "macroexpand-1" (pretty-string (macroexpand-1 form))))))