Oskar:

I once did installations like this of SLIME for interaction with SBCL on my computers, and I did it once for Clojure about a year ago, but when I tried to upgrade that SLIME/Clojure interaction software recently, I had trouble trying to do so in a similar way that I had done it in the past. In particular, look at the section labeled "swank-clojure.el" near the end of this page:

http://github.com/technomancy/swank-clojure

I decided to abandon my little-understood section of my .emacs file from my previous installs, and try to install it using the currently- recommended method. Below are the steps I've gone through on a couple of Macs, and one Ubuntu 10.4 virtual machine, starting from I think nothing but an Emacs and Clojure 1.2 installation. You might not even need Clojure installed anywhere in order for this to work, since the 'lein deps' step downloads jars for Clojure and contrib.

Andy



Source of these instructions:

http://github.com/technomancy/leiningen/blob/master/README.md
http://github.com/technomancy/swank-clojure

Short version of how to do the install on a new Mac:

Backup your current .emacs file, just in case.

% cp -p ~/.emacs ~/.emacs.bak

Install Leiningen (use a web browser for the first step, if you do not
have curl).  ~/bin already exists on my system, and is in my command
path.  You should use whatever directory you wish in place of that.

% curl http://github.com/technomancy/leiningen/raw/stable/bin/lein > ~/ bin/lein
% chmod 755 ~/bin/lein
% lein self-install

Make a brand new Clojure project using Leiningen.  Again, modify the
directory from my ~/sw/new-clj-proj to suit you.  THe name of the
project in the 'lein new' command is also pretty arbitrary.  The only
use you will likely make of this project is to start a java process
with the Clojure jar(s) and able to interact with SLIME.

% mkdir -p ~/sw/new-clj-proj
% cd ~/sw/new-clj-proj
% lein new new-clj-proj .

Use a text editor to edit project.clj.  Remove ')' from end of file,
then add this new last line:

  :dev-dependencies [[swank-clojure "1.2.1"]])

Save the file and quit editor.

% lein deps

That takes about 30 seconds to complete.

From now on, you can do this to start a Clojure process that listens
for connections from SLIME.

% cd ~/sw/new-clj-proj
% lein swank


Now to install clojure-mode and slime-repl packages in Emacs.  Fire up
emacs.  Copy and paste the Elisp code below into a buffer.  Select it
as a region, and use M-x eval-region to evaluate it.
----------------------------------------
  (let ((buffer (url-retrieve-synchronously
               "http://tromey.com/elpa/package-install.el";)))
  (save-excursion
    (set-buffer buffer)
    (goto-char (point-min))
    (re-search-forward "^$" nil 'move)
    (eval-region (point) (point-max))
    (kill-buffer (current-buffer))))
----------------------------------------

Now do this in Emacs:

M-x package-list-packages

Use arrow keys or n/p to move cursor to lines for clojure-mode package
and slime-repl package, and press 'i' key on each one to mark them for
installation.  Then hit 'x' to execute those markings.  Use 'h' for
brief help in the bottom of the Emacs window.

Mark these two packages with 'i':

clojure-mode
slime-repl

Press 'x' to execute the installation.

From now on, use this command to start a SLIME session connected to a
Clojure process, after doing the 'lein swank' command above.

M-x slime-connect




On Sep 11, 2010, at 7:55 PM, Oskar wrote:

Hey!

I am trying to set up clojure for emacs. I use ubuntu and gnu emacs
23. I followed this guide 
http://riddell.us/ClojureWithEmacsSlimeSwankOnUbuntu.html
In particular, I did:

~$ cd opt
~/opt$ git clone git://github.com/jochu/clojure-mode.git
~/opt$ git clone git://git.boinkor.net/slime.git
~/opt$ git clone git://github.com/jochu/swank-clojure.git


And then I appended the following to my ~/.emacs:

;; clojure-mode
(add-to-list 'load-path "~/opt/clojure-mode")
(require 'clojure-mode)

;; swank-clojure
(add-to-list 'load-path "~/opt/swank-clojure/src/emacs")

(setq swank-clojure-jar-path "~/.clojure/clojure.jar"
     swank-clojure-extra-classpaths (list
                                      "~/opt/swank-clojure/src/main/clojure"
                                      "~/.clojure/clojure-contrib.jar"))

(require 'swank-clojure-autoload)

;; slime
(eval-after-load "slime"
 '(progn (slime-setup '(slime-repl))))

(add-to-list 'load-path "~/opt/slime")
(require 'slime)
(slime-setup)


However, when I start emacs I can't do M-x slime. What did I do wrong?
Just so you know, I just switched to ubuntu from windows today, and
I'm a beginner at clojure, git, linux, emacs... you name it. :)

--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to