How do I start the REPL in a user defined namespace?

前端 未结 7 1395
傲寒
傲寒 2020-12-06 17:13

Writing (in-ns \'dbx) to a file and loading it isn\'t changing the default namespace of the repl (using cygwin/console). The namespace is still user=><

7条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-06 17:46

    In addition to Carlos' answer suggesting :repl-options {:init-ns foo.bar}, I have also had success with adding :dev {:main user} to my profile.clj.

    To give more context:

    ;; /foo/profile.clj
    ...
    :main foo.core
    :dev {:main user
          :source-paths ["dev"]}`
    ...
    
    ;; /foo/dev/user.clj
    (ns user
      (:require
       [clojure.pprint :refer (pprint)]
       [clojure.repl :refer :all]
       [clojure.string :as str]
       [clojure.test :refer [run-tests run-all-tests]]
       [clojure.tools.namespace.repl :refer [refresh refresh-all]]))
    

提交回复
热议问题