简体   繁体   中英

How to automate loading leiningen repl from within Emacs?

I'm using Emacs, integrated with Leiningen's swank. Each time I need to start working with .clj file I have to:

  1. Run emacs pack/my-ns.clj from console.
  2. Type Mx lein-swank .
  3. Compile buffer.
  4. In Clojure REPL change namespace, ie type (in-ns 'pack.my-ns) .

How can I automate this process to just run from console something like emacs-clj pack/my-ns.clj and get my environment ready to use?

I don't have an answer to the question you posed, but you should be able to replace your 4th step with Cc Mp while in your Clojure file and then emacs should prompt you as to what namespace you want to be in with the namespace of the file auto-detected so you can simply hit enter. Cc Mp maps to slime-repl-set-package .

Update:

Just stumbled across this . Should be able to take what is said in that answer and modify it so upon initial connection to swank files get compiled. Could also set it up to automatically switch to namespace and make the repl buffer active.

Swank启动时应自动将:repl-init-script指向的名称空间加载到project.clj中,因此,如果要将其设置为起始名称空间,则可以开始使用。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM