Saturday, 30 July 2011

Auto Complete in Clojure

This is awesome. My one concern about switching from Eclipse to Emacs for Clojure was losing the handy auto-complete stuff in Eclipse. I no longer have that concern:



Install the auto-complete mode (M-x package-install, auto-complete if using ELPA).

Download ac-slime from here: https://github.com/purcell/ac-slime

Here is the config required to set it up:

;; auto complete
(require 'auto-complete-config)
(add-to-list 'ac-dictionary-directories "~/.emacs.d/ac-dict")
(ac-config-default)
(setq ac-delay 0.5) ;; eclipse uses 500ms

;; configure auto complete to work in slime
(add-to-list 'load-path "~/.emacs.d/ac-slime")
(require 'ac-slime)
(add-hook 'slime-mode-hook 'set-up-slime-ac)
(add-hook 'slime-repl-mode-hook 'set-up-slime-ac)

1 comment:

  1. Hi Alexander.

    I'm starting with Clojre and Emacs at the same time. And this entry was very helpful.

    Now with auto complete working is much more fun and productive to hack Clojure!!

    Thanks.

    ReplyDelete