[英]Emacs (Cocoa Emacs) vs Aquamacs for running Clojure on Mac OS X
I used Aquamacs so far, and I need to install and run Clojure using SLIME . 到目前为止我使用了Aquamacs ,我需要使用SLIME安装和运行Clojure 。 I googled to get some way to use Clojure on SLIME of Aquamacs, but without success.
我用谷歌搜索了一些方法在Aquamacs的SLIME上使用Clojure,但没有成功。
I tried with Mac OS X Emacs , and by following the steps I could make it work. 我尝试使用Mac OS X Emacs ,并按照我可以使其工作的步骤。 I mean, I could run Clojure with SLIME.
我的意思是,我可以用SLIME运行Clojure。
Step 1) Install ESK . 步骤1)安装ESK 。
.emacs.d
directory .emacs.d
目录中 .emacs
and relaunch .emacs
并重新启动 (when (load (expand-file-name "~/.emacs.d/package.el")) (package-initialize))
Step2) Install using ELPA 步骤2)使用ELPA安装
.emacs
and relaunch .emacs
并重新启动 ;; clojure mode (add-to-list 'load-path "/Users/smcho/.emacs.d/elpa/clojure-mode-1.7.1") (require 'clojure-mode-autoloads) (add-to-list 'load-path "/Users/smcho/.emacs.d/elpa/clojure-test-mode-1.4") (require 'clojure-test-mode-autoloads) ;; slime ;(setq inferior-lisp-program "/Users/smcho/bin/clojure") (add-to-list 'load-path "/Users/smcho/.emacs.d/elpa/slime-20100404") (require 'slime-autoloads) (add-to-list 'load-path "/Users/smcho/.emacs.d/elpa/slime-repl-20100404") (require 'slime-repl-autoloads) ;; swank-clojure (add-to-list 'load-path "/Users/smcho/.emacs.d/elpa/swank-clojure-1.1.0") (require 'slime-repl-autoloads)
Now I could use Clojure on Emacs, I tried the same(or very similar) method to run Clojure on Aquamacs once more. 现在我可以在Emacs上使用Clojure,我尝试了相同(或非常相似)的方法再次在Aquamacs上运行Clojure。
Step 1) Install ESK for Aquamacs 步骤1) 为Aquamacs安装ESK
(setq kitfiles-dir (concat (file-name-directory (or (buffer-file-name) load-file-name)) "/aquamacs-emacs-starter-kit")) ; set up our various directories to load (add-to-list 'load-path kitfiles-dir) (require 'init)
Step2) * Follow the same step as before to install all the (same) packages, but "Mx slime" gives me the following error message. 步骤2)*按照以前的步骤安装所有(相同)软件包,但“Mx slime”给我以下错误消息。 "Symbol's function definition is void: define-slime-contrib"
“符号的函数定义是无效的:define-slime-contrib”
I tried to combine the packages from Emacs and Aquamacs, but they don't combine. 我试图将Emacs和Aquamacs的软件包结合起来,但它们并没有结合起来。 I thought I could use the ELPA itself, not from the ESK to make it shared.
我以为我可以使用ELPA本身,而不是ESK来共享它。
The result was not good, as ELPA couldn't download the swank-conjure package. 结果并不好,因为ELPA无法下载swank-conjure包。
Aquamacs most definitely works with Clojure, since the author of Clojure uses it. 由于Clojure的作者使用它,因此Aquamacs绝对适用于Clojure。 However, I use Emacs, and after you perform the steps above in the Emacs section, I recommend checking out labrepl,
但是,我使用Emacs,在Emacs部分执行上述步骤后,我建议查看labrepl,
http://github.com/relevance/labrepl http://github.com/relevance/labrepl
If you don't have leiningen, the link to get and install it is in the instructions of the labrepl readme file. 如果您没有leiningen,则获取并安装它的链接位于labrepl自述文件的说明中。 I found it extremely helpful when first learning how to set up an environment for Clojure programming.
在第一次学习如何为Clojure编程设置环境时,我发现它非常有用。 You can take apart the
project.clj
file in labrepl and piece together how it works pretty easily. 您可以拆开labrepl中的
project.clj
文件,并将它的工作方式非常简单地拼凑起来。 Not to mention the lessons and training in the built in web application that comes with labrepl. 更不用说labrepl附带的内置Web应用程序中的课程和培训。
If you want to use lein swank instead: 如果你想使用lein swank代替:
Make sure you have leiningen installed. 确保安装了leiningen。 In your project.clj dev dependencies you want to have an entry like this:
在您的project.clj dev依赖项中,您希望拥有如下条目:
[leiningen/lein-swank "1.1.0"]
http://clojars.org/leiningen/lein-swank http://clojars.org/leiningen/lein-swank
Then after you've done lein deps
you should be able to run lein swank
and then from within Emacs run Mx slime-connect
and just press enter through the defaults. 然后在你完成
lein deps
你应该能够运行lein swank
,然后从Emacs中运行Mx slime-connect
,只需按下默认输入即可。
If you're going to go this route, here is the link directly to leiningen so you can skip the labrepl repository: http://github.com/technomancy/leiningen 如果你打算走这条路,这里是直接连接到leiningen的链接,所以你可以跳过labrepl存储库: http ://github.com/technomancy/leiningen
Paul Barry gives an lecture how to use Aquamacs and Clojure. Paul Barry讲授如何使用Aquamacs和Clojure。
It's simple as you can add this code to the .emacs
file, 这很简单,因为您可以将此代码添加到
.emacs
文件中,
(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 could run 'Mx clojure-mode', and Cc Cz for REPL. 我可以运行'Mx clojure-mode',以及Cc Cz for REPL。
And as is asked and answered in Running Clojure and other Lisp at the same time on Emacs , I could use both Clojure/Lisp on Aquamacs. 正如在Emacs上同时在Running Clojure和其他Lisp中提问和回答的那样,我可以在Aquamacs上同时使用Clojure / Lisp。
I found this the easiest setup for the latest version of everything. 我发现这是最新版本的最简单的设置。 Here's a quick summary where I"m assuming you have leiningen installed.
这是一个快速摘要,我假设你已经安装了leiningen。
Install the swank-clojure plugin 安装swank-clojure插件
$ lein plugin install swank-clojure 1.3.2
Create your clojure project 创建你的clojure项目
$ lein new test-project
$ cd test-project
$ lein deps
Then open one of the clojure files from your project in emacs and run clojure-jack-in 然后在emacs中打开项目中的一个clojure文件并运行clojure-jack-in
M-x clojure-jack-in
You are now in a slime buffer with clojure and the dependencies for your project loaded. 您现在处于一个slime缓冲区,其中包含clojure并且已加载项目的依赖项。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.