12

I used Aquamacs so far, and I need to install and run Clojure using SLIME. I googled to get some way to use Clojure on SLIME of Aquamacs, but without success.

Questions

  1. Is it possible to install Clojure on Aquamacs? Or, can you guess why Clojure on Aquamacs doesn't work?
  2. Is it normal that Emacs and Aquamacs can't share the same ELPA?
  3. Is it possible to use ELPA to install Conjure on Emacs/Aquamacs?
  4. I was told that one can use 'lein swank' to run as a server, do you know how to do that?

Sequences that I tried (and half succeeded)

I tried with Mac OS X Emacs, and by following the steps I could make it work. I mean, I could run Clojure with SLIME.

Emacs for Mac OS X

Step 1) Install ESK.

  • Git clone and copy all the files into the .emacs.d directory
  • Add the following code to .emacs and relaunch
    (when
        (load
         (expand-file-name "~/.emacs.d/package.el"))
      (package-initialize))

Step2) Install using ELPA

  • M-x package-list-packages to select packages
  • Install
    • clojure-mode, clojure-test-mode
    • slime, slime-repl
    • swank-clojure
  • M-x slime to install the clojure
  • Add the following code to .emacs and relaunch
;; 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)

Aquamacs

Now I could use Clojure on Emacs, I tried the same(or very similar) method to run Clojure on Aquamacs once more.

Step 1) Install ESK for Aquamacs

  • Copy the files to ~/Library/Preference/Aquamacs Emacs
  • Modify "~/Library/Preferences/Aquamacs Emacs/Preferences.el" to add the following
(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 "M-x slime" gives me the following error message. "Symbol's function definition is void: define-slime-contrib"

ELPA

I tried to combine the packages from Emacs and Aquamacs, but they don't combine. I thought I could use the ELPA itself, not from the ESK to make it shared.

The result was not good, as ELPA couldn't download the swank-conjure package.

Success - Running Aquamacs/Clojure with 'lein swank'.

Please refer to this.

4

3 回答 3

5

Aquamacs 绝对可以与 Clojure 一起使用,因为 Clojure 的作者使用它。但是,我使用 Emacs,在执行 Emacs 部分中的上述步骤后,我建议您查看 labrepl,

http://github.com/relevance/labrepl

如果您没有 leiningen,获取和安装它的链接在 labrepl 自述文件的说明中。在第一次学习如何设置 Clojure 编程环境时,我发现它非常有用。您可以project.clj在 labrepl 中拆开文件,然后将它的工作原理拼凑起来。更不用说 labrepl 附带的内置 Web 应用程序中的课程和培训了。

如果您想改用 lein swank:

确保您已安装 leiningen。在您的 project.clj 开发依赖项中,您希望有这样的条目:

[leiningen/lein-swank "1.1.0"]

http://clojars.org/leiningen/lein-swank

然后在你完成之后,lein deps你应该能够运行lein swank,然后在 Emacs 中运行M-x slime-connect,只需通过默认值按 Enter。

如果你打算走这条路,这里是 leiningen 的直接链接,因此你可以跳过 labrepl 存储库:http: //github.com/technomancy/leiningen

于 2010-07-27T01:08:46.653 回答
2

Paul Barry就如何使用 Aquamacs 和 Clojure 进行了讲座。

这很简单,您可以将此代码添加到.emacs文件中,

(添加到列表'加载路径“〜/clojure/clojure-mode”)
(setq 劣质 lisp 程序“/Users/smcho/bin/clj”)
(需要'clojure-mode)
(setq 自动模式列表
  (缺点 '("\\.clj\\'" .clojure-mode)
     自动模式列表))
(add-hook 'clojure-mode-hook
  (拉姆达()
     (define-key clojure-mode-map "\Cc\Ce" 'lisp-eval-last-sexp)))

我可以为 REPL 运行“Mx clojure-mode”和 Cc Cz。

正如在 Emacs 上同时运行 Clojure 和其他 Lisp 中所问和回答的那样,我可以在 Aquamacs 上同时使用 Clojure/Lisp。

于 2010-07-27T04:38:38.190 回答
2

我发现是最新版本所有内容的最简单设置。这是我假设您已安装 leiningen 的快速摘要。

安装 swank-clojure 插件

$ lein plugin install swank-clojure 1.3.2

创建你的 clojure 项目

$ lein new test-project
$ cd test-project
$ lein deps

然后在 emacs 中打开项目中的一个 clojure 文件并运行 clojure-jack-in

M-x clojure-jack-in

您现在处于一个带有 clojure 的粘液缓冲区中,并且已加载项目的依赖项。

于 2011-10-07T20:59:01.970 回答