-
-
Notifications
You must be signed in to change notification settings - Fork 653
Closed
Description
My understanding is that cider implements pretty-printing in the REPL and elsewhere by wrapping the expression to be evaluated in an explicit clojure.pprint/pprint
form (e.g. https://github.com/clojure-emacs/cider/blob/master/cider-repl.el#L554). Naturally, this leaves *1
holding nil
, something I presume no one likes.
I'd like to suggest two options:
- Evaluate an interpolated expression like
(let [x %s] (clojure.pprint/pprint x) x)
, which will leave*1
set properly.cider-repl-handler
can then simply not do anything with:value
, which will ensure that only one printed representation of the evaluated value is seen, e.g.:
(lambda (buffer value)
(if (not cider-repl-use-pretty-printing)
(cider-repl-emit-result buffer value t)))
- Alternatively (and perhaps as a more long-term solution), the standard
pr-values
middleware can be modified to provide aset!
-able session-local configuration var so that clients/users can (a) set which function should generate the printed representation of:value
, and (b) set which slot in the response message that representation should put in (since certain printed representations are likely notread
-able, something that:value
strings really should be).
I've tweaked my cider locally to do (1), and it works well. Would you like a patch for that?
Further, thoughts on the utility of (2) are welcome.
Metadata
Metadata
Assignees
Labels
No labels