简体   繁体   English

如何自动从Emacs中加载leiningen repl?

[英]How to automate loading leiningen repl from within Emacs?

I'm using Emacs, integrated with Leiningen's swank. 我使用的是Emacs, 与Leiningen的动作集成在一起。 Each time I need to start working with .clj file I have to: 每次我需要开始使用.clj文件时,我都必须:

  1. Run emacs pack/my-ns.clj from console. 从控制台运行emacs pack/my-ns.clj
  2. Type Mx lein-swank . 输入Mx lein-swank
  3. Compile buffer. 编译缓冲区。
  4. In Clojure REPL change namespace, ie type (in-ns 'pack.my-ns) . 在Clojure REPL中更改名称空间,即键入(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? 如何才能自动执行此过程,使其仅从控制台运行,例如emacs-clj pack/my-ns.clj并准备使用我的环境?

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. 对于您提出的问题,我没有答案,但是您应该可以在Clojure文件中用Cc Mp替换第4步,然后emacs应该用的名称空间提示您要使用的名称空间该文件会自动检测到,因此您只需按Enter键即可。 Cc Mp maps to slime-repl-set-package . Cc Mp映射到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. 应该能够接受该答案中所说的内容,并对其进行修改,以便在与swank文件的初始连接时得到编译。 Could also set it up to automatically switch to namespace and make the repl buffer active. 也可以将其设置为自动切换到名称空间并使repl缓冲区处于活动状态。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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