emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] [babel] hemorrhaging at the bleeding edge: using clojure


From: Eric Schulte
Subject: Re: [O] [babel] hemorrhaging at the bleeding edge: using clojure
Date: Wed, 27 Apr 2011 07:10:02 -0600
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

Eric S Fraga <address@hidden> writes:

> Hi all!
>
> I have started using clojure for some serious programming and,
> obviously, org comes to mind as my development environment, having very
> successfully used org+babel for Octave code development.  Clojure is
> installed just fine and I have been using leiningen for project
> management up to now (just to get started).
>
> However, in trying to use org, I am hitting a wall in getting clojure
> source code blocks to be evaluated.  Can somebody on the list that has
> been using clojure with org-babel please help me get going?  I am
> getting stuck in getting the whole slime or swank or whatever bits that
> are necessary working in Emacs 24.0.x...
>
> I have searched extensively on the web and have tried a number of
> approaches, including elpa to install clojure-mode, slime, et al., as
> suggested by the =org-contrib/babel/languages/ob-doc-clojure= tutorial
> on Worg, but have not yet managed to get a working setup.  In
> particular, depending on the version of elpa I use (this is where the
> /bleeding edge/ issue in my subject above comes in), I get different
> errors.  With the latest version of elpa, I cannot find the
> swank-clojure package!  With older versions, I cannot get slime to
> install.  Sigh.
>

I would suggest using that latest version of ELPA, and adding the
following repository sources to your ELPA archives...

#+srcname: starter-kit-elpa
#+begin_src emacs-lisp 
  (require 'package)
  (add-to-list 'package-archives
               '("original" . "http://tromey.com/elpa/";))
  (add-to-list 'package-archives
               '("technomancy" . "http://repo.technomancy.us/emacs/";) t)
  ;; (add-to-list 'package-archives
  ;;              '("marmalade" . "http://marmalade-repo.org/packages/";) t) 
  (package-initialize)
#+end_src

This should result in the correct collection of packages being made
available.  Once that is done I've used something like the following
successfully in the past.

#+begin_src emacs-lisp
  ;; clojure
  (setq swank-clojure-classpath "/home/eschulte/.clojure.d/ext/")
  (require 'clojure-mode)
  (require 'swank-clojure)
  (require 'slime)
  (require 'slime-repl)
  (setq swank-clojure-binary "/home/eschulte/bin/clj-env"
        swank-clojure-jar-path "/home/eschulte/.clojure.d/ext/clojure-1.2.0.jar"
        slime-lisp-implementations
        (cons `(clojure ,(swank-clojure-cmd) :init swank-clojure-init)
              (remove-if #'(lambda (x) (eq (car x) 'clojure))
                         slime-lisp-implementations)))
  
  ;; don't know why this is needed all of a sudden
  (add-hook 'clojure-mode-hook (lambda () (font-lock-mode t)))
  
  (setf slime-default-lisp 'clojure)
#+end_src

>
> I am quite surprised at the difficulty in getting a proper lisp support
> installed in Emacs!
>

I've found Clojure to be much harder to configure for working with Emacs
than traditional common lisp environments.  Even now, although I can run
multiple different versions of common lisp side-by-side, I am unable to
activate the Clojure portion of my Emacs configuration without breaking
common lisp support.  I guess my point is that Clojure is a special case
of lisp in this instance...

>
> Any advice more than welcome!
>

Once you have slime working, then Babel code blocks should be trivial
(they rely on a slime session).  Be sure to use the ":package" header
argument to specify the namespace in which to evaluate your clojure
code.

Best -- Eric

>
> Thanks,
> eric

-- 
Eric Schulte
http://cs.unm.edu/~eschulte/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]