Question

How do I get Clojure to load a project-specific .clj file on repl launch? I want to have some function available to me whenever I open up a new repl (I'm using nREPL on emacs, for what it's worth...)

Thanks

Was it helpful?

Solution

Add an entry to your project.clj's :repl-options like the following

:repl-options {:init (load-file "src/your-project-specific-file.clj") }

If you'd like your functions to be available in all your REPLs, add an entry the user profile in .lein/profiles.clj as follows:

{
 :user
  {:repl-options {:init (load-file "path/to/file.clj")}}
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top