Emacs (Cocoa Emacs) vs Aquamacs for running Clojure on Mac OS X

£可爱£侵袭症+ 提交于 2019-11-27 18:52:30
Brandon Henry

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

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.

prosseek

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!