Skip to content

Commit

Permalink
CLJS-1150: lift cljs.repl/repl cljs.user ns form evalution into defau…
Browse files Browse the repository at this point in the history
…lt init
  • Loading branch information
swannodette committed Mar 19, 2015
1 parent 1208fe5 commit 4d1bbd6
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions src/clj/cljs/repl.clj
Expand Up @@ -647,10 +647,9 @@
[repl-env {:keys [init need-prompt prompt flush read eval print caught reader
print-no-newline source-map-inline wrap repl-requires
compiler-env]
:or {init #()
need-prompt #(if (readers/indexing-reader? *in*)
(== (readers/get-column-number *in*) 1)
(identity true))
:or {need-prompt #(if (readers/indexing-reader? *in*)
(== (readers/get-column-number *in*) 1)
(identity true))
prompt repl-prompt
flush flush
read repl-read
Expand All @@ -674,8 +673,7 @@
(merge-with (fn [a b] (if (nil? b) a b))
repl-opts
opts
{:init init
:prompt prompt
{:prompt prompt
:need-prompt need-prompt
:flush flush
:read read
Expand Down Expand Up @@ -711,6 +709,13 @@
(catch Throwable e
(caught e repl-env opts)
opts))))
init (or init
#(evaluate-form repl-env env "<cljs repl>"
(with-meta
`(~'ns ~'cljs.user
(:require ~@repl-requires))
{:line 1 :column 1})
identity opts))
read-eval-print
(fn []
(let [input (binding [*ns* (create-ns ana/*cljs-ns*)
Expand All @@ -733,15 +738,9 @@
(fn []
(binding [*repl-opts* opts]
(try
(init)
(when analyze-path
(analyze-source analyze-path opts))
(evaluate-form repl-env env "<cljs repl>"
(with-meta
`(~'ns ~'cljs.user
(:require ~@repl-requires))
{:line 1 :column 1})
identity opts)
(init)
(catch Throwable e
(caught e repl-env opts)))
(when-let [src (:watch opts)]
Expand Down

0 comments on commit 4d1bbd6

Please sign in to comment.