technomancy/leiningen — pull request #963 by mtopolnik (2013-01-29 11:07:30+00:00)
Title: Fix for issue #955

Enhancements to the lein repl task regarding the treatment of the initial namespace. The individual commits take care of the following, in that order:

1. Evaluate the `:init` form before starting the server; remove the evaluation of the `:init` form from `:repl-options/:custom-init`;
2. add initial namespace to the list of `init-requires`; remove `require init-ns` from `:repl-options/:custom-init`;
3. bind (in userland context) `leiningen.repl.config/project-map` to the project map;
4. now that `require init-ns` happens before server startup, make the repl connection timeout longer (1 minute);
5. try to start the nrepl server even if some requires fail. This is to maintain the currently observed behavior where `require init-ns` is happening after the server has already started.

With these changes any nrepl client may evaluate

(when-let [pm (resolve 'leiningen.repl.config/project-map)]
(in-ns (or (-> @pm :repl-options :init-ns) (:main @pm))))

to enter the initial namespace.