From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Eric Schulte" Subject: Re: [babel] hemorrhaging at the bleeding edge: using clojure Date: Wed, 27 Apr 2011 07:10:02 -0600 Message-ID: <87wrifkevi.fsf@gmail.com> References: <87k4egi0u5.fsf@ucl.ac.uk> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([140.186.70.92]:34834) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QF4hy-0004EK-Sk for emacs-orgmode@gnu.org; Wed, 27 Apr 2011 09:23:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QF4hu-0004os-6O for emacs-orgmode@gnu.org; Wed, 27 Apr 2011 09:23:10 -0400 Received: from mail-pv0-f169.google.com ([74.125.83.169]:53132) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QF4ht-0004ol-Rg for emacs-orgmode@gnu.org; Wed, 27 Apr 2011 09:23:06 -0400 Received: by pvc12 with SMTP id 12so1698503pvc.0 for ; Wed, 27 Apr 2011 06:23:05 -0700 (PDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Eric S Fraga 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/