Clojure and Common Lisp Compatibility on Mac Os X
John-Poplett opened this issue · 2 comments
Requirements
While searching for a satisfactory solution to a compatible Clojure / CL emacs configuration, I started to understand my requirements better. The fundamental requirement was that the emacs configuration must allow for unobtrusive use of Clojure, Common Lisp, Quicklisp, Slime and SBCL.
As a secondary requirement, the solution could not involve manual maintenance and conflict management of multiple copies of slime.
If you're programming in Common Lisp, then you probably know why Quicklisp is a requirement. It's the package manager that CL brings parity with the best of the younger programming languages. If you're working on Clojure, you probably want leiningen for similar reasons.
Solution
Most of the solutions I've seen put the user through contortions or, when I've tried them, don't work (at least not on Mac Os X with Quicklisp as part of the equation).
The solution I am experimenting with at the moment is surprisingly simple. This approach gave me inspiration but fails on the count of requiring too much manual slime configuration management. It did helped me to realize though that I could defer loading slime and only run slime setup on demand, i.e. on M-x slime. That way, if instead, I want to run clojure, I can M-x clojure-jack-in without the presence of a potentially conflicting slime setup in my emacs image. This is an excerpt from my .emacs file. Most of this is just standard Quicklisp slime initialization.
;;; Define a slime that defers slime setup. It first detaches itself
;;; then runs slime setup, then invokes the "real" slime.
;;; By delaying slime setup, quicklisp slime setup doesn't interfere
;;; with M-x clojure-jack-in.
;;;
(defun slime ()
(interactive)
(fmakunbound 'slime)
(load (expand-file-name "~/quicklisp/slime-helper.el"))
(set-language-environment "UTF-8")
(setq slime-net-coding-system 'utf-8-unix)
(setq inferior-lisp-program "/usr/local/bin/sbcl")
(slime))
With this minor modification, M-x slime behaves as before and continues to use the Quicklisp maintained copy of Slime. If I am working in Clojure, M-x clojure-jack-in works as expected. This is working for me with Aquamacs and GNU Emacs for Mac OS X (24).
Setup is based on Emacs for Mac Os X (23.3.1), Quicklisp Slime current (08/11), Swank-clojure 1.3.2 and Snow Leopard. The initial Clojure-swank setup came from the technomancy's readme on the swank-clojure github site.
Problems Along the Way
- Multiple versions of swank-clojure in my classpath; removed older plugins with lein plugin uninstall.
- Emacs couldn't find my Brew installed line in the path; adding this to .emacs was sufficient: (setenv "PATH" (concat "/usr/local/bin:" (getenv "PATH")))
- Aquamacs had an old version of Slime installed in its private elpa location ( /Users/john/Library/Application Support/Aquamacs Emacs/elpa), a leftover from a previous Clojure integration effort . Removing the older versions of slime from the Aquamacs location allowed me to use the Quicklisp version of slime, same as GNU Emacs for Mac Os X.
I will add a link to this explanation to the readme under troubleshooting as it trips up a lot of people.
Great! I jotted that down after going through that for a second time!
Regards,
John
On Mon, Dec 19, 2011 at 5:57 PM, Phil Hagelberg <
reply@reply.github.com
wrote:
I will add a link to this explanation to the readme under troubleshooting
as it trips up a lot of people.
Reply to this email directly or view it on GitHub:
#66 (comment)