emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Eric Schulte" <schulte.eric@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: [babel] hemorrhaging at the bleeding edge: using clojure
Date: Wed, 27 Apr 2011 07:10:02 -0600	[thread overview]
Message-ID: <87wrifkevi.fsf@gmail.com> (raw)
In-Reply-To: 87k4egi0u5.fsf@ucl.ac.uk

Eric S Fraga <e.fraga@ucl.ac.uk> 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	other threads:[~2011-04-27 13:23 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-27  7:56 [babel] hemorrhaging at the bleeding edge: using clojure Eric S Fraga
2011-04-27 13:10 ` Eric Schulte [this message]
2011-04-27 15:50   ` Eric S Fraga
2011-04-28 16:53   ` Eric S Fraga
2011-04-28 17:08     ` Eric S Fraga
2011-04-28 18:22     ` Eric Schulte
2011-04-28 20:21       ` Eric S Fraga
2011-04-28 20:41         ` Eric Schulte

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87wrifkevi.fsf@gmail.com \
    --to=schulte.eric@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).