在 Emacs 上同时运行 Clojure 和其他 Lisp [英] Running Clojure and other Lisp at the same time on Emacs

查看:23
本文介绍了在 Emacs 上同时运行 Clojure 和其他 Lisp的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 Aquamacs,Aquamacs 预装了 SLIME.

I use Aquamacs, and Aquamacs is pre-equipped with SLIME.

(setq inferior-lisp-program "/usr/local/bin/sbcl") #####!!!
(add-to-list 'load-path "/Library/Application Support/Aquamacs Emacs/SLIME/contrib")
(add-to-list 'load-path "/Library/Application Support/Aquamacs Emacs/SLIME")
(require 'slime)
(slime-setup)

正如某处所问,我尝试通过添加此代码来使用 Clojure.

As is asked in somewhere, I try to use Clojure by adding this code.

(add-to-list 'load-path "~/clojure/clojure-mode")
(setq inferior-lisp-program "/Users/smcho/bin/clj") ################
(require 'clojure-mode)
(setq auto-mode-alist
  (cons '("\.clj$ . clojure-mode")
     auto-mode-alist))
(add-hook 'clojure-mode-hook
  '(lambda ()
     (define-key clojure-mode-map "C-cC-e" 'lisp-eval-last-sexp)))
)

我无法让它与 SLIME 一起运行 Clojure,但我对当前设置感到满意,唯一的问题是因为 (setqenisp-program ...)代码,我必须根据我使用 Clojure 或 SBCL 更改 .emacs 代码.

I couldn't make it Clojure run with SLIME, but I'm satisfied with the current setting, the only problem is that because of the (setq inferior-lisp-program ...) code, I have to change the .emacs code depending on I use Clojure or SBCL.

有什么办法可以解决这个问题吗?我可以在多个(劣质)Lisps 之间进行选择吗?

Is there any way to solve this problem? Can I choose between multiple (inferior) Lisps?

我可以让 Clojure 在 Aquamacs 上运行.请参阅在 Aquamacs 问题上使用lein swank"运行 Clojure.如果你想运行 Aquamacs/Clojure,忘记上面写的设置.你只需要一行,(slime-setup '(slime-repl))lein swank.

I could make Clojure run on Aquamacs. Please refer to Running Clojure with 'lein swank' on Aquamacs problem. Forget about the settings written above, if you want to run Aquamacs/Clojure. You need just one line, (slime-setup '(slime-repl)) and lein swank.

推荐答案

当然,您可以使用 Cu Mx slime 而不是 Mx slime 让 SLIME 要求您要启动的 Lisp 可执行文件的名称,已填入默认值.

Sure, you can use C-u M-x slime instead of just M-x slime to have SLIME ask you for the name of the Lisp executable to be launched, with whatever is your default already filled in.

还有一个 slime-lisp-implementations 变量,我是这样配置的:

There's also a slime-lisp-implementations variable which I have configured like so:

(setq slime-lisp-implementations
      `((clojure ,(swank-clojure-cmd) :init swank-clojure-init)
        (sbcl ("sbcl") :coding-system utf-8-unix)))

我不得不说我已经不记得这对我有什么作用了(如果它确实有什么作用的话)...输入 Ch v slime-lisp-implementations 大致了解它是什么应该做的.如果我想开始,我似乎必须输入 sbcl,这对我来说很好,因为我的 SLIME 中 Clojure 与 SBCL 的比率很高.

I have to say that I just can't remember what this does for me anymore (if indeed it does anything)... Type C-h v slime-lisp-implementations to learn roughly what it's supposed to do. I seem to have to type sbcl if I want to start that, which is fine by me due to the high Clojure-to-SBCL ratio in my SLIME'ing.

更新:

我刚刚重新发现了 M-- Mx slime(第一个键是负参数的元减号),它提示输入 slime-lisp 中 Lisp 实现的名称之一-implementations(带有制表符补全),然后启动所需的 Lisp.使用上面的示例配置,M-- M-x slime sbcl 启动 SBCL.

I have just rediscovered M-- M-x slime (that first key is meta-minus for a negative argument), which prompts for one of the names of Lisp implementations in slime-lisp-implementations (with tab completion) and then starts the required Lisp. With the above example config, M-- M-x slime sbcl starts SBCL.

(我发现这很有用,主要是因为它允许配置更复杂的命令来启动 Lisp——例如 (sbcl-options ("sbcl" "--an-option" "--another-option") ...), (sbcl-clbuild ("/path/to/clbuild" "lisp") ...) -- 并按名称引用它们.)

(I find this useful mostly because of how it allows one to configure more complex commands to start Lisp -- e.g. (sbcl-options ("sbcl" "--an-option" "--another-option") ...), (sbcl-clbuild ("/path/to/clbuild" "lisp") ...) -- and refer to them by name.)

这篇关于在 Emacs 上同时运行 Clojure 和其他 Lisp的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆