For those that do not know what *print-length* stands for:
If you (set! *print-length* 200), and you evaluate (range) in a REPL, which normally causes an infinite list of numbers to get printed, only the first 200 numbers will get printed.
I’m trying to set this as a default for all my REPLs in profiles.clj.
Right now I got this, but it doesn’t work:
{:user {:plugins [[lein-swank "1.4.4"]
[lein-catnip "0.5.0"]]
:repl-options {*print-length* 200}}
:dev {:dependencies [[clj-ns-browser "1.2.0"]
[org.clojure/tools.trace "0.7.5"]]}}
What’s wrong with this?
Update. Tnx Michal for answering this. My fixed profiles.clj now looks like this. Note that it only works inside a project.
{:user {:plugins [[lein-swank "1.4.4"]
[lein-catnip "0.5.0"]]
:repl-options {:init (set! *print-length* 200)}}
:dev {:dependencies [[clj-ns-browser "1.2.0"]
[org.clojure/tools.trace "0.7.5"]]}}
:repl-optionsneeds to be a map of options supported by Leiningen’srepltask; anything else will be ignored.*print-length*is not a valid option (and neither isnil; I’d have to check to be sure if the keys are evaluated here, but this won’t work either way).Instead you should use something like
See
sample.project.cljin the root of Leiningen’s repository for a description of the available options (including:init).