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

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

问题描述

我使用 Aquamacs ,而Aquamacs预装了 SLIME

  (setq inferior-lisp-program/ usr / local / bin / sbcl)##### !!! 
(add-to-list'load-path)/库/应用程序支持/ Aquamacs Emacs / SLIME / contrib)
(add-to-list'load-path/ Library / Application Support / Aquamacs Emacs / SLIME)
(require'slime)
(slime-setup)

如某个地方所问,我尝试使用Clojure添加这个代码。

 (add-to-list'加载路径〜/ clojure / clojure-mode)
(setq inferior-lisp-program/ Users / smcho / bin / clj)############### #
(需要'clojure-mode)
(setq auto-mode-alist
(cons'(\\.clj $。clojure-mode)
auto -mode-alist))
(add-hook'clojure-mode-hook
'(lambda()
(define-key clojure-mode-map\Cc\Ce 'lisp-eval-last-sexp)))

我无法做它Clojure运行与SLIME,但我对目前的设置感到满意,唯一的问题是,由于(setq inferior-lisp-program ...)代码,我必须改变 .emacs 代码取决于我使用Clojure或 SBCL



有没有办法解决这个问题?我可以选择多个(下)Lisps吗?



添加



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

解决方案

当然,您可以使用 Cu Mx粘液而不是仅将 Mx粘滞有SLIME要求您启动Lisp可执行文件的名称,无论您的默认值是否已填写。



还有一个 slime-我已经配置的lisp-implementation 变量:

 (setq slime-lisp-implementation 
`((clojure,(swank-clojure-cmd):init swank-clojure-init)
(sbcl(sbcl):encoding-system utf-8-unix)))

我不得不说,我不记得这对我做了什么(如果确实有什么)。 ..键入 Ch v slime-lisp-implementation ,大致了解它应该做什么。如果我想开始,我似乎必须键入 sbcl ,这是因为我的SLIME'ing中的Clojure-to-SBCL比率很高。 p>

更新:



我刚刚重新发现了M- Mx粘液(第一个键是负参数的meta-minus),它提示在 slime-lisp-implementation 中的Lisp实现的名称之一(带有选项卡完成)然后启动所需的Lisp。使用上面的配置示例, M-- Mx slime sbcl 启动SBCL。



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


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)

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-c\C-e" 'lisp-eval-last-sexp)))
)

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.

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

Added

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.

解决方案

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.

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)))

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.

Update:

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.

(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天全站免登陆