mfikes / ambly

ClojureScript REPL into embedded JavaScriptCore
http://ambly.fikesfarm.com
Eclipse Public License 1.0
541 stars 21 forks source link

Honor `:print`, `:print-no-newline` and `:flush` #41

Closed mfikes closed 9 years ago

mfikes commented 9 years ago

See https://github.com/clojure/clojurescript/commit/41f6aa91a2df7413f9e2a2cc4f0dc4f9644cf28a

IRC 2015-02-19:

[13:17:36] <dnolen> brucehauman: tjakubow: mfikes: one thing to be aware of the coming word, you cannot just call print/println or flush anymore since you don't know under what context the REPL is being used
[13:17:50] <dnolen> opts will always contain the :print and :flush fn that you should use

Also, :print-no-newline: https://github.com/clojure/clojurescript/commit/7beec094542563977c442f73c8200bb994753f6b

mfikes commented 9 years ago

Testing by inspection using

(repl/repl* (jsc/repl-env)
    {:optimizations    :none
     :cache-analysis   true
     :source-map       true
     :print-no-newline #(print (str "<" (apply str (interpose " " %&)) ">"))
     :print            #(println (str "<" (apply str (interpose " " %&)) "\\n>"))
     :flush            #(do (print "<f>") (flush))})
mfikes commented 9 years ago

Fixed committed locally. Holding off on push a bit...