Arcadia icon indicating copy to clipboard operation
Arcadia copied to clipboard

jagged printing in emacs

Open timsgardner opened this issue 7 years ago • 1 comments

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.

timsgardner avatar Nov 13 '18 06:11 timsgardner

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).

saikyun avatar Dec 27 '18 10:12 saikyun