Emacs (Cocoa Emacs) 与 Aquamacs 在 Mac OS X 上运行 Clojure

发布于 2024-09-10 06:56:01 字数 3131 浏览 6 评论 0原文

到目前为止,我使用了 Aquamacs,我需要安装并运行 Clojure 使用 SLIME。我在 google 上搜索了一些在 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 中并重新启动
    (when
        (load
         (expand-file-name "~/.emacs.d/package.el"))
      (package-initialize))

Step2) 使用 ELPA

  • Mx package-list-packages 选择 安装软件包
  • 安装
    • clojure 模式、clojure 测试模式
    • 史莱姆,史莱姆-repl
    • swank-clojure
  • M-x slime 安装 clojure
  • 将以下代码添加到 .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)

Aquamacs

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

步骤 1) 安装 ESK for Aquamacs

  • 将文件复制到 ~/Library/Preference /Aquamacs Emacs
  • 修改“~/Library/Preferences/Aquamacs Emacs/Preferences.el”添加以下
(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)

步骤2) * 按照与之前相同的步骤安装所有(相同)软件包,但“Mx slime”给我以下错误消息。 “符号的函数定义无效:define-slime-contrib”

ELPA

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

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

成功 - 使用“lein swank”运行 Aquamacs/Clojure。

请参阅

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

爱的故事 2024-09-17 06:56:01

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

http: //github.com/relevance/labrepl

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

如果您想改用 lein swank:

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

[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

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

春庭雪 2024-09-17 06:56:01

我发现这个 所有最新版本的最简单设置。这是一个快速总结,我假设您已经安装了 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

您现在位于 slime 缓冲区中已加载 clojure 和项目的依赖项。

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.

Install the swank-clojure plugin

$ lein plugin install swank-clojure 1.3.2

Create your clojure project

$ 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

M-x clojure-jack-in

You are now in a slime buffer with clojure and the dependencies for your project loaded.

儭儭莪哋寶赑 2024-09-17 06:56:01

Paul Barry 发表演讲使用 Aquamacs 和 Clojure。

这很简单,您可以将此代码添加到 .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)))

我可以运行“Mx clojure-mode”,并抄送 Cz 进行 REPL。

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

Paul Barry gives an lecture how to use Aquamacs and Clojure.

It's simple as you can add this code to the .emacs file,

(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 'M-x clojure-mode', and C-c C-z 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文