A drop in replacement for clojure.main/repl-read, since a readline can return multiple Clojure forms this function is stateful and buffers the forms and returns the next form on subsequent reads.
This function is a constructor that takes a line-reader and returns
a function that can replace clojure.main/repl-read.
Example Usage:
(clojure.main/repl :prompt (fn []) ;; prompt is handled by line-reader :read (clj-repl-read (line-reader (repl-balance.clojure.service.local/create))))
Or catch a bad terminal error and fall back to clojure.main/repl-read:
(clojure.main/repl :prompt (fn []) :read (try (clj-repl-read (line-reader (repl-balance.clojure.service.local/create))) (catch clojure.lang.ExceptionInfo e (if (-> e ex-data :type (= :repl-balance.jline-api/bad-terminal)) (do (println (.getMessage e)) clojure.main/repl-read) (throw e)))))
A drop in replacement for clojure.main/repl-read, since a readline
can return multiple Clojure forms this function is stateful and
buffers the forms and returns the next form on subsequent reads.
This function is a constructor that takes a line-reader and returns
a function that can replace `clojure.main/repl-read`.
Example Usage:
(clojure.main/repl
 :prompt (fn []) ;; prompt is handled by line-reader
 :read (clj-repl-read
         (line-reader
           (repl-balance.clojure.service.local/create))))
Or catch a bad terminal error and fall back to clojure.main/repl-read:
(clojure.main/repl
 :prompt (fn [])
 :read (try
        (clj-repl-read
         (line-reader
           (repl-balance.clojure.service.local/create)))
        (catch clojure.lang.ExceptionInfo e
           (if (-> e ex-data :type (= :repl-balance.jline-api/bad-terminal))
              (do (println (.getMessage e))
                  clojure.main/repl-read)
              (throw e)))))(syntax-highlight-prn x)Print a syntax highlighted clojure value.
This printer respects the current color settings set in the service.
The repl-balance.jline-api/*line-reader* and
repl-balance.jline-api/*service* dynamic vars have to be set for
this to work.
See repl-balance.main for an example of how this function is normally used
Print a syntax highlighted clojure value. This printer respects the current color settings set in the service. The `repl-balance.jline-api/*line-reader*` and `repl-balance.jline-api/*service*` dynamic vars have to be set for this to work. See `repl-balance.main` for an example of how this function is normally used
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs | 
| ← | Move to previous article | 
| → | Move to next article | 
| Ctrl+/ | Jump to the search field |