在 Mac OS X 上运行 Clojure 的 Emacs (Cocoa Emacs) 与 Aquamacs [英] Emacs (Cocoa Emacs) vs Aquamacs for running Clojure on Mac OS X

查看:21
本文介绍了在 Mac OS X 上运行 Clojure 的 Emacs (Cocoa Emacs) 与 Aquamacs的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

到目前为止我使用了 Aquamacs,我需要安装和运行 Clojure 使用 SLIME.我在谷歌上搜索了一些在 Aquamacs 的 SLIME 上使用 Clojure 的方法,但没有成功.

问题

  1. 是否可以在 Aquamacs 上安装 Clojure?或者,您能猜出为什么 Aquamacs 上的 Clojure 不起作用吗?
  2. Emacs 和 Aquamacs 不能共享相同的 ELPA 是否正常?
  3. 是否可以使用 ELPA 在 Emacs/Aquamacs 上安装 Conjure?
  4. 有人告诉我可以使用lein swank"作为服务器运行,你知道怎么做吗?

我尝试过的序列(成功了一半)

我尝试使用 Mac OS X Emacs,并按照以下步骤操作.我的意思是,我可以用 SLIME 运行 Clojure.

Mac OS X 的 Emacs

步骤 1) 安装 ESK.

  • Git clone 并将所有文件复制到.emacs.d 目录
  • 将以下代码添加到 .emacs 并重新启动
<前>(什么时候(加载(展开文件名~/.emacs.d/package.el"))(包初始化))

Step2) 使用 ELPA 安装

  • M-x package-list-packages 选择包
  • 安装
    • clojure-mode, clojure-test-mode
    • slime,slime-repl
    • 华丽的服装
  • M-x slime 来安装 clojure
  • 将以下代码添加到 .emacs 并重新启动
<前>;;Clojure 模式(添加到列表'加载路径/Users/smcho/.emacs.d/elpa/clojure-mode-1.7.1")(需要 'clojure-mode-autoloads)(添加到列表'加载路径/Users/smcho/.emacs.d/elpa/clojure-test-mode-1.4")(需要 'clojure-test-mode-autoloads);;粘液;(setq 下级 lisp-program "/Users/smcho/bin/clojure")(添加到列表'加载路径/Users/smcho/.emacs.d/elpa/slime-20100404")(需要 'slime-autoloads)(添加到列表'加载路径/Users/smcho/.emacs.d/elpa/slime-repl-20100404")(需要 'slime-repl-autoloads);;时髦的Clojure(添加到列表'加载路径/Users/smcho/.emacs.d/elpa/swank-clojure-1.1.0")(需要 'slime-repl-autoloads)

Aquamacs

现在我可以在 Emacs 上使用 Clojure,我尝试了相同(或非常相似)的方法来再次在 Aquamacs 上运行 Clojure.

步骤 1) 安装 ESK for Aquamacs

  • 将文件复制到 ~/Library/Preference/Aquamacs Emacs
  • 修改~/Library/Preferences/Aquamacs Emacs/Preferences.el"添加以下内容
<前>(setq kitfiles-dir (concat (file-name-directory(或 (buffer-file-name) load-file-name)) "/aquamacs-emacs-starter-kit"));设置我们要加载的各种目录(添加到列表加载路径工具包文件目录")(需要'初始化)

步骤 2)* 按照与之前相同的步骤安装所有(相同)软件包,但M-x slime"给了我以下错误消息."Symbol 的函数定义是无效的:define-slime-contrib"

ELPA

我尝试合并来自 Emacs 和 Aquamacs 的包,但它们没有合并.我想我可以使用 ELPA 本身,而不是来自 ESK 来共享它.

结果并不好,因为 ELPA 无法下载 swank-conjure 包.

成功 - 使用lein swank"运行 Aquamacs/Clojure.

请参考这个.

解决方案

Aquamacs 绝对适用于 Clojure,因为 Clojure 的作者使用了它.但是,我使用 Emacs,在您执行 Emacs 部分中的上述步骤后,我建议您查看 labrepl,

http://github.com/relevance/labrepl

如果您没有 leiningen,获取和安装它的链接位于 labrepl 自述文件的说明中.当我第一次学习如何为 Clojure 编程设置环境时,我发现它非常有帮助.您可以拆开labrepl 中的project.clj 文件,然后很容易地拼凑出它的工作原理.更不用说 labrepl 附带的内置网络应用程序中的课程和培训了.

如果您想改用 lein swank:

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

[leiningen/lein-swank "1.1.0"]

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

然后在你完成 lein deps 之后你应该能够运行 lein swank 然后在 Emacs 中运行 Mx slime-connect然后按回车键进入默认设置.

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

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.

解决方案

Aquamacs most definitely works with Clojure, since the author of Clojure uses it. However, I use Emacs, and after you perform the steps above in the Emacs section, I recommend checking out 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. I found it extremely helpful when first learning how to set up an environment for Clojure programming. You can take apart the project.clj file in labrepl and piece together how it works pretty easily. Not to mention the lessons and training in the built in web application that comes with labrepl.

If you want to use lein swank instead:

Make sure you have leiningen installed. In your project.clj dev dependencies you want to have an entry like this:

[leiningen/lein-swank "1.1.0"]

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 M-x slime-connect and just press enter through the defaults.

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

这篇关于在 Mac OS X 上运行 Clojure 的 Emacs (Cocoa Emacs) 与 Aquamacs的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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