-
Notifications
You must be signed in to change notification settings - Fork 175
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom pretty printing #247
Conversation
Awesome! |
Nice! I like the idea.
One thing you could do currently is check for the presence of any of these libs, and use it if it's available. This way the user wouldn't have to manually configure anything complicated, they would only need to add the lib to their
We could use a dynamic var to store the Would that work? |
Couldn't this middleware also take into consideration the For instance, we can:
Would this be useful? |
Yeah, this is the way to go. I'll just need to check if their APIs have remained stable for the past few versions, or if we need to sniff the version that is available.
Oh, of course, the debugger relies on eval - so we know that
Hmm, I like the idea, but I think the One idea I did have is an op that would let you press a button while viewing a stacktrace to either |
Actually, now that you mentioned it, I remember that's not always the case. It's not a huge deal, but it comes up a lot, and it means we can't just rely on I'm fine with both options. The second would be more troublesome, but would ensure we respect
Makes sense. 👍 |
I guess this should be rebased and merged. |
@cichli ping :-) |
@bbatsov pong :-). Sorry for letting this one languish - I'm finishing off the elisp bits for this now. |
Roger that. :-) On Thursday, 3 December 2015, Michael Griffiths notifications@github.com
Best Regards, |
I see some odd test failures. Did someone look into them? |
@benedekfazekas seems mranderson is failing in some of these test runs |
ack. will check |
Looks like all of the JDK6 builds and the Eastwood are failing on master as well as the PR branch? https://travis-ci.org/clojure-emacs/cider-nrepl/builds/94641627 I'll see if I can track down the Eastwood one after work today. |
A possible workaround could be to tell mranderson to skip java class repackaging: context |
Yeah, that seems like the smart thing to do. |
yup I created an issue so I don't forget but the workaround should unblock the PR |
I removed the support for Clojure 1.5 and 1.6 (and Java 6). Now you can finally wrap this PR. |
Seems that some eastwood check is breaking the build. |
The readme also has to be updated. |
The Eastwood failure is still about the data-readers file. |
We should exclude this file or something. Or ignore the eastwood failures for now. |
👍 |
Context: clojure-emacs/cider#1179
This PR adds a new
wrap-pprint-fn
middleware, that accepts the set of all printing-related options that we currently use for the eval/stacktrace/test/refresh middlewares, in addition to a newpprint-fn
option (which must be the name of the function to be used for printing, e.g."clojure.pprint/pprint"
). It then constructs a closure that wraps up all the options and the provided printing function, placing it into the request map (again under thepprint-fn
key) so that subsequent middlewares can just call the function without having to care about all the different options.Eventually I'd like to provide some alternative printers to
clojure.pprint/pprint
out-of-the-box, but ATM the main candidates (fipp; puget; aprint) all require at least Clojure 1.6, so I'm holding off on adding them as dependencies for now.Two places where we could be using this, but aren't yet:
stacktrace/analyze-causes
ineval-with-locals
and it would be a bit awkward to passpprint-fn
all the way down the stack... @Malabarba thoughts? Just use a dynamic var maybe?clojure.pprint/write
directly - I still need to investigate if it makes sense to allow use of a custom printing fn here.Note that there's a breaking change here - the
right-margin
option has been renamed toprint-right-margin
, for consistency. cc @laurentpetit @tpope