jagged printing in emacs
Functions that involve multiple calls to print, println, (.Write ^TextWriter w "bla"), etc – basically anything that writes to *out* in multiple steps – are prone to print to the emacs repl in a garbled form, with newlines inserted and removed seemingly at random. This makes data almost unreadable. For example, the following:
(pprint
(let [f (fn f [i]
(if (<= i 0)
:leaf
(vec
(repeatedly 3
#(f (dec i))))))]
(f 4)))
prints as:
[[
[[:leaf :leaf
:leaf] [:leaf :leaf :leaf] [:leaf :leaf :leaf]]
[[:leaf :leaf :leaf] [:leaf :leaf
:leaf] [:leaf :leaf :leaf]]
[[:leaf :leaf :leaf] [:leaf :leaf :leaf] [:leaf :leaf :leaf]]]
[[[:leaf :leaf :leaf] [:leaf :leaf :leaf] [:leaf :leaf :leaf]]
[[:leaf :leaf :leaf] [:leaf :leaf :leaf] [:leaf :leaf :leaf]]
[[:leaf :leaf :leaf] [:leaf :leaf :leaf] [:leaf :leaf :leaf]]]
[[[:leaf :leaf :leaf] [:leaf :leaf :leaf] [:leaf :leaf :leaf]
]
[[:leaf :leaf
:leaf] [:leaf :leaf :leaf] [:leaf :leaf :leaf]]
[[:leaf :leaf :leaf] [:leaf :leaf :leaf] [:leaf :leaf :leaf]]]]
In Nostrand it evidently prints as
[[[[:leaf :leaf :leaf] [:leaf :leaf :leaf] [:leaf :leaf :leaf]]
[[:leaf :leaf :leaf] [:leaf :leaf :leaf] [:leaf :leaf :leaf]]
[[:leaf :leaf :leaf] [:leaf :leaf :leaf] [:leaf :leaf :leaf]]]
[[[:leaf :leaf :leaf] [:leaf :leaf :leaf] [:leaf :leaf :leaf]]
[[:leaf :leaf :leaf] [:leaf :leaf :leaf] [:leaf :leaf :leaf]]
[[:leaf :leaf :leaf] [:leaf :leaf :leaf] [:leaf :leaf :leaf]]]
[[[:leaf :leaf :leaf] [:leaf :leaf :leaf] [:leaf :leaf :leaf]]
[[:leaf :leaf :leaf] [:leaf :leaf :leaf] [:leaf :leaf :leaf]]
[[:leaf :leaf :leaf] [:leaf :leaf :leaf] [:leaf :leaf :leaf]]]]
Among other things, this could be:
- something about the repl
- something about the repl protocol
- something about inf-clojure
- something about the port we're listening on
This is a fairly major issue because it makes complex data unreadable.
Does the same thing happen if you use the standard read function? It seems similar to the issue where the repl gets stuck, which doesn't happen when you use the standard read function (as described in #292).