Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where should the file user.clj go?

I am trying to setup proto-repl atom-editor package and apparently it needs a file user.clj to exist somewhere - which I guess is some leiningen's init file.

Where should I create this file?

like image 394
Pedro Rolo Avatar asked Mar 26 '16 12:03

Pedro Rolo


2 Answers

Clojure will load the file user.clj from your class path if it is found. In a default leinengen project src/ will be on the class path, so if you create src/user.clj the contents of that file will be loaded in the context of the user namespace.

user is the default namespace for the clojure repl, but some leiningen projects override this. In order to access definitions in user.clj you will need to either pull user into scope (using require or use) or make sure that user is your starting namespace.

like image 53
noisesmith Avatar answered Sep 29 '22 11:09

noisesmith


See the Proto REPL demo project https://github.com/jasongilman/proto-repl-demo/blob/master/dev/user.clj for an example of how to setup user.clj You should also add a dependency on clojure.tools.namespace in the project.clj https://github.com/jasongilman/proto-repl-demo/blob/master/project.clj

I just pushed some changes to Proto REPL last night to improve this area but you'll still benefit from having one setup.

like image 31
Jason Gilman Avatar answered Sep 29 '22 10:09

Jason Gilman