Re: Loading a .clj file automatically at repl startup?
You can also create a small start.clj file that does whatever it needs to do (use 'foo) and ends with a call to (clojure.main/repl) -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Loading a .clj file automatically at repl startup?
Depending how you're starting the REPL, it looks like there is also a command line option. Here's parts of the doc string from the main fn in src/clj/clojure/main.clj (version 1.0.0): (defn main "Usage: java -cp clojure.jar clojure.main [init-opt*] [main-opt] [arg*] With no options or args, runs an interactive Read-Eval-Print Loop init options: -i, --init path Load a file or resource -e, --eval string Evaluate expressions in string; print non-nil values ...[snip] - Runs all init options in order - Runs a repl or script if requested The init options may be repeated and mixed freely, but must appear before any main option. The appearance of any eval option before running a repl suppresses the usual repl greeting message: \"Clojure ~(clojure- version)\". " Caveat: I haven't actually tried this. -tom On Dec 28, 5:01 pm, Sean Devlin wrote: > There's a user.clj file that can be customized for this purpose. Make > sure it's in your classpath. > > On Dec 28, 6:16 pm, Mike K wrote: > > > Is it possible to load a library such as foo.clj (with (ns foo ...) at > > the top of the file) into the repl automatically at startup, rather > > than having to (use 'foo) every time the repl starts? I'd like to > > avoid creating a .jar file. > > > If possible, I'd like to do this both from the command line ("java - > > cp ...") and from within slime / emacs. > > > Thanks, > > Mike -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Loading a .clj file automatically at repl startup?
There's a user.clj file that can be customized for this purpose. Make sure it's in your classpath. On Dec 28, 6:16 pm, Mike K wrote: > Is it possible to load a library such as foo.clj (with (ns foo ...) at > the top of the file) into the repl automatically at startup, rather > than having to (use 'foo) every time the repl starts? I'd like to > avoid creating a .jar file. > > If possible, I'd like to do this both from the command line ("java - > cp ...") and from within slime / emacs. > > Thanks, > Mike -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Loading a .clj file automatically at repl startup?
Is it possible to load a library such as foo.clj (with (ns foo ...) at the top of the file) into the repl automatically at startup, rather than having to (use 'foo) every time the repl starts? I'd like to avoid creating a .jar file. If possible, I'd like to do this both from the command line ("java - cp ...") and from within slime / emacs. Thanks, Mike -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en