How do I get Clojure to load a project-specific .clj file on REPL launch?

StackOverflow https://stackoverflow.com/questions/18289716

  •  24-06-2022
  •  | 
  •  

سؤال

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

هل كانت مفيدة؟

المحلول

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")}}
}
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top