[英]Clojure repl - how can I insure that :reload-all does indeed reload all required namespaces?
[英]Can I configure things to be automatically required by the Clojure REPL?
有一些功能非常通用,無論我當前切換到哪個命名空間,我都希望它們始終在REPL中可用。
有沒有一種方法可以配置lein repl
自動需要一些東西,以便它們在全球范圍內可用? 另一種選擇是調用類似的東西(use 'clojure.tools.trace)
。
Leiningen 2.x支持:repl-options
來更改REPL的行為方式, 包括:init
hook 。 萊寧根將在第一次打開REPL時運行此鈎子,因此它只會影響您的:main
命名空間。
這是使用此選項的示例:
:repl-options { :init (require '[criterium.core
:refer [bench quick-bench]])}
您可以在對應的project.clj
文件中為每個項目在本地設置:repl-options
,也可以將其放入~/.lein/profiles.clj
文件中進行~/.lein/profiles.clj
:
{:user {:repl-options {:init (...)}}}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.