如何设置 Aquamacs 进行 Clojure 开发?

发布于 2024-08-18 20:18:10 字数 514 浏览 6 评论 0原文

我曾多次尝试迁移到 Emacs 进行 Clojure 开发,遵循各种博客文章、截屏视频和教程,但在此过程中总会出现问题 - 键绑定不起作用、版本不兼容等,我发现自己争先恐后地回到 Vim。但我知道我想要 Paredit 和 SLIME。

因此,我将再次尝试,这次得到了强大的 Stack Overflow™ 社区的支持。

我希望这个问题的答案能够保持最新,并且可以为像我这样的尝试性皈依者提供参考。

我想要的是:

  • Clojure Aquamacs 的最新稳定版本
  • (如果它对 Rich Hickey 来说足够好,那么对我来说也足够好),最新版本的
  • Clojure Mode
  • SLIME/SWANK
  • Paredit
  • 还有其他必不可少的吗?

安装上述内容的分步说明会非常好 - 最好是 shell 脚本格式。我还想要一些关于如何开始使用最常见的 Clojure 相关操作(包括键绑定)的提示,包括文档和备忘单的链接。

I've tried to migrate to Emacs several times for Clojure development, following a variety of blogposts, screencast and tutorials, but somewhere along the way something always went wrong - keybindings that didn't work, incompatible versions, etc, and I found myself scrambling back to Vim. But I know I want Paredit and SLIME.

So, I'm going to try again, this time backed by the powerful Stack Overflow™ community.

I hope that the answer to this question will remain up-to-date, and can serve as a reference for tentative converts like me.

What I'd like is:

  • The latest stable release of Clojure
  • Aquamacs (if it's good enough for Rich Hickey, it's good enough for me), a recent version
  • Clojure Mode
  • SLIME/SWANK
  • Paredit
  • Anything else that's indispensible?

Step-by-step instructions to install the above would be excellent - preferably in shell script format. I'd also like some hints on how to get started with the most common Clojure-related actions (including key-bindings), including links to documentation and cheatsheets.

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

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

发布评论

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

评论(6

少年亿悲伤 2024-08-25 20:18:10

这些是我在不使用 ELPA 的情况下设置它们所采取的步骤。希望这有帮助。

使用 MacPorts 获取 SLIME

sudo port -v install slime

获取 paredit

curl -O http://mumble.net/~campbell/emacs/paredit.el

获取 clojure & 获取clojure-contrib

  • 要么使用 MacPorts
sudo port -v install clojure clojure-contrib
  • 要么直接下载
curl -O http://build.clojure.org/snapshots/org/clojure/clojure/1.1.0-master-SNAPSHOT/clojure-1.1.0-master-20091202.150145-1.jar
curl -O http://build.clojure.org/snapshots/org/clojure/clojure-contrib/1.1.0-master-SNAPSHOT/clojure-contrib-1.1.0-master-20091212.205045-1.jar

获取 clojure-mode 和 swank-clojure (Emacs 端)

git clone http://github.com/technomancy/clojure-mode.git
git clone http://github.com/technomancy/swank-clojure.git

获取 swank-clojure (Clojure 端)

  • 要么下载预构建的 jar 文件
curl -O http://repo.technomancy.us/swank-clojure-1.1.0.jar
  • 要么从源代码构建(假设安装了 lein)
cd path/to/dir/swank-clojure
lein jar

把 clojure, clojure ~/.swank-clojure 或 ~/.clojure 中的 -contrib 和 swank-clojure .jar 文件(swank-clojure.el 搜索它们的默认位置)。


添加到 ~/.emacs 或 ~/Library/Preferences/Aquamacs Emacs/customization.el (更改路径以匹配您自己的设置)

(add-to-list 'load-path "/opt/local/share/emacs/site-lisp/slime/")
(add-to-list 'load-path "/opt/local/share/emacs/site-lisp/slime/contrib/")
;; Change these paths to match your settings
(add-to-list 'load-path "path/to/dir/clojure-mode/")
(add-to-list 'load-path "path/to/dir/swank-clojure/")
(add-to-list 'load-path "path/to/dir/paredit/")

;; Customize swank-clojure start-up to reflect possible classpath changes
;; M-x ielm `slime-lisp-implementations RET or see `swank-clojure.el' for more info 
(defadvice slime-read-interactive-args (before add-clojure)
(require 'assoc)
(aput 'slime-lisp-implementations 'clojure
(list (swank-clojure-cmd) :init 'swank-clojure-init)))

(require 'slime)
(require 'paredit)
(require 'clojure-mode)
(require 'swank-clojure)

(eval-after-load "slime"
  '(progn
    ;; "Extra" features (contrib)
    (slime-setup 
     '(slime-repl slime-banner slime-highlight-edits slime-fuzzy))
    (setq 
     ;; Use UTF-8 coding
     slime-net-coding-system 'utf-8-unix
     ;; Use fuzzy completion (M-Tab)
     slime-complete-symbol-function 'slime-fuzzy-complete-symbol)
    ;; Use parentheses editting mode paredit
    (defun paredit-mode-enable () (paredit-mode 1))
    (add-hook 'slime-mode-hook 'paredit-mode-enable)
    (add-hook 'slime-repl-mode-hook 'paredit-mode-enable)))

;; By default inputs and results have the same color
;; Customize result color to differentiate them
;; Look for `defface' in `slime-repl.el' if you want to further customize
(custom-set-faces
 '(slime-repl-result-face ((t (:foreground "LightGreen")))))

(eval-after-load "swank-clojure"
  '(progn
    ;; Make REPL more friendly to Clojure (ELPA does not include this?)
    ;; The function is defined in swank-clojure.el but not used?!?
    (add-hook 'slime-repl-mode-hook
      'swank-clojure-slime-repl-modify-syntax t)
    ;; Add classpath for Incanter (just an example)
    ;; The preferred way to set classpath is to use swank-clojure-project
    (add-to-list 'swank-clojure-classpath 
"path/to/incanter/modules/incanter-app/target/*")))

These are the steps I took to set them up without using ELPA. Hope this helps.

Get SLIME using MacPorts

sudo port -v install slime

Get paredit

curl -O http://mumble.net/~campbell/emacs/paredit.el

Get clojure & clojure-contrib

  • Either using MacPorts
sudo port -v install clojure clojure-contrib
  • Or downloading directly
curl -O http://build.clojure.org/snapshots/org/clojure/clojure/1.1.0-master-SNAPSHOT/clojure-1.1.0-master-20091202.150145-1.jar
curl -O http://build.clojure.org/snapshots/org/clojure/clojure-contrib/1.1.0-master-SNAPSHOT/clojure-contrib-1.1.0-master-20091212.205045-1.jar

Get clojure-mode and swank-clojure (Emacs side)

git clone http://github.com/technomancy/clojure-mode.git
git clone http://github.com/technomancy/swank-clojure.git

Get swank-clojure (Clojure side)

  • Either downloading pre-built jar file
curl -O http://repo.technomancy.us/swank-clojure-1.1.0.jar
  • Or building from source (assuming lein is installed)
cd path/to/dir/swank-clojure
lein jar

Put clojure, clojure-contrib and swank-clojure .jar files in ~/.swank-clojure or ~/.clojure (the default places where swank-clojure.el searches for them).


Add to either ~/.emacs or ~/Library/Preferences/Aquamacs Emacs/customization.el (change paths to match your own settings)

(add-to-list 'load-path "/opt/local/share/emacs/site-lisp/slime/")
(add-to-list 'load-path "/opt/local/share/emacs/site-lisp/slime/contrib/")
;; Change these paths to match your settings
(add-to-list 'load-path "path/to/dir/clojure-mode/")
(add-to-list 'load-path "path/to/dir/swank-clojure/")
(add-to-list 'load-path "path/to/dir/paredit/")

;; Customize swank-clojure start-up to reflect possible classpath changes
;; M-x ielm `slime-lisp-implementations RET or see `swank-clojure.el' for more info 
(defadvice slime-read-interactive-args (before add-clojure)
(require 'assoc)
(aput 'slime-lisp-implementations 'clojure
(list (swank-clojure-cmd) :init 'swank-clojure-init)))

(require 'slime)
(require 'paredit)
(require 'clojure-mode)
(require 'swank-clojure)

(eval-after-load "slime"
  '(progn
    ;; "Extra" features (contrib)
    (slime-setup 
     '(slime-repl slime-banner slime-highlight-edits slime-fuzzy))
    (setq 
     ;; Use UTF-8 coding
     slime-net-coding-system 'utf-8-unix
     ;; Use fuzzy completion (M-Tab)
     slime-complete-symbol-function 'slime-fuzzy-complete-symbol)
    ;; Use parentheses editting mode paredit
    (defun paredit-mode-enable () (paredit-mode 1))
    (add-hook 'slime-mode-hook 'paredit-mode-enable)
    (add-hook 'slime-repl-mode-hook 'paredit-mode-enable)))

;; By default inputs and results have the same color
;; Customize result color to differentiate them
;; Look for `defface' in `slime-repl.el' if you want to further customize
(custom-set-faces
 '(slime-repl-result-face ((t (:foreground "LightGreen")))))

(eval-after-load "swank-clojure"
  '(progn
    ;; Make REPL more friendly to Clojure (ELPA does not include this?)
    ;; The function is defined in swank-clojure.el but not used?!?
    (add-hook 'slime-repl-mode-hook
      'swank-clojure-slime-repl-modify-syntax t)
    ;; Add classpath for Incanter (just an example)
    ;; The preferred way to set classpath is to use swank-clojure-project
    (add-to-list 'swank-clojure-classpath 
"path/to/incanter/modules/incanter-app/target/*")))
生来就爱笑 2024-08-25 20:18:10

下载并安装 Aquamacs。

下载并安装 ELPA (http://tromey.com/elpa/install.html

) Mx package-list-packages

用“I”标记名为“clojure-mode”和“swank-clojure”的行,然后按“X”。

完毕。

Download and install Aquamacs.

Download and install ELPA (http://tromey.com/elpa/install.html)

Do M-x package-list-packages

Mark the lines called "clojure-mode" and "swank-clojure" with "I" then press "X".

Done.

帅气尐潴 2024-08-25 20:18:10

这里有一篇博客文章提到了 Aquamacs:设置 Clojure、Incanter、Emacs、Slime、斯万克和帕雷迪

Here's a blog post that mentions Aquamacs: Setting up Clojure, Incanter, Emacs, Slime, Swank, and Paredit

哭了丶谁疼 2024-08-25 20:18:10

似乎有一种相当简单的方法可以为 clojure 设置 Aquamacs 2.4 和 SLIME:

  1. 安装 Clojure
  2. 从此处安装 Aquamacs 2.4 “http://aquamacs.org/”
  3. 从此处安装 Aquamacs SLIME 包 “http://aquamacs.org /download.shtml”

这个不会工作所以...

  1. 从这里获取最新版本的 SLIME“http://common-lisp.net/project/slime/#downloading” - 你想要的CVS 快照 tar 文件
  2. 解压 SLIME tar 文件并将其复制到
    /Library/Application Support/Aquamacs Emacs/SLIME

似乎对我来说工作正常......

There seems to be a fairly easy way to set up Aquamacs 2.4 and SLIME for clojure:

  1. Install Clojure
  2. Install Aquamacs 2.4 from here "http://aquamacs.org/"
  3. Install the Aquamacs SLIME package from here "http://aquamacs.org/download.shtml"

This will not work so...

  1. Get the latest version of SLIME from here "http://common-lisp.net/project/slime/#downloading" - you want the CVS snapshot tar file
  2. Unpack the SLIME tar file and copy it into
    /Library/Application Support/Aquamacs Emacs/SLIME

Seems to work OK for me...

总攻大人 2024-08-25 20:18:10

我知道 OP 想使用 Emacs 进行 Clojure 开发。我自己是 emacs 粉丝,但我发现使用 Enclojure (http://www.enclojure.org/home< /a>) 是快速开始破解 Clojure 的好方法。

I know the OP wants to use Emacs for Clojure dev. I'm an emacs fan myself, but I found using Enclojure (http://www.enclojure.org/home) to be a great way to get started quickly with hacking Clojure.

你怎么这么可爱啊 2024-08-25 20:18:10

今天我将前往 https://github.com/tehcurtis/aquamacs-emacs- starter-kit/network

这是用于 ruby​​ 的,一开始不起作用,但无论如何。 git clone 并根据自述文件将内容复制到 Preferences.el 。通过编辑〜/ Library / Preferences / Aquamacs Emacs /并注释掉modes.el中的几乎所有内容来修复损坏(我在文件中只留下了(setq-default indent-tabs-mode nil))

好的部分:你有 现在安装 elpa-package-manager 的麻烦更少了

:使用

M-x package-list-packages

go

clojure-mode   (press I)
slime          (press I)
slime-repl     (press I)

Press X to install

完成。

警告:clojure-jack-in 不会工作,所以你必须

M-x slime-connect

按两次 Enter 和 y 才能启动。

Today I would head for https://github.com/tehcurtis/aquamacs-emacs-starter-kit/network

this is for ruby and wont work at first but anyway. git clone and copy things to Preferences.el according to readme. Fix the brokenness by edit the ~/Library/Preferences/Aquamacs Emacs/ and comment out almost everything in modes.el (I have only (setq-default indent-tabs-mode nil) left in the file)

The good part: you have installed elpa-package-manager with less hassle

now: use

M-x package-list-packages

go to

clojure-mode   (press I)
slime          (press I)
slime-repl     (press I)

Press X to install

done.

Caveat: clojure-jack-in wont work so you have to

M-x slime-connect

and press enter twice and y to start.

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