views:

545

answers:

2

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. Does anyone succeed installing clojure on Aquamcs? Or, can you guess why clojure on Aqumac doesn't work?
  2. Is it normal that emacs and aquamacs can't share the same ELPA?
  3. Does anyone succeed in using 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.

+1  A: 

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. 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 repo: http://github.com/technomancy/leiningen

Brandon H
I installed leiningen, and could run 'lein swank'.With 'M-x slime-connect', I could see the 'user>' prompt, but it doesn't evaluate equation like '(+ 3 4)'. It just doesn't return anything.
prosseek
hmm. i didn't have to add any lisp code to my emacs config file when i used ESK. perhaps something you did in there is causing a problem.
Brandon H
@Brandon : You're right, I understand what went wrong. Thanks.
prosseek
A: 

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

It's simple as you can add this code to the .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)))

I could run 'M-x clojure-mode', and C-c C-z for REPL.

And as is asked and answered here, I could use both clojure/lisp on Aquamacs.

prosseek