Search code examples
emacsautocompleteclojureslime

How to do automatic expansion or autocomplete of functions and variables in a Clojure repl


Is there a way to expand the current command at the Clojure repl like I'd be able to do in Common Lisp?

For example say I have typed:

Math/

I would like the tab key to expand to all the available variables and functions in that namespace.

I'm using Clojure as inferior-lisp would like to know how to do this from the plain vanilla repl in Clojure, and through swank slime.


Solution

  • Another vote in favour of clojure-mode and slime under Emacs. In particular, if you set up auto-complete, then you can use my ac-slime package to get context-aware tab completion in a dropdown list. Here's a screencast showing it in action.

    And, further to technomancy's comment about hippie-expand, here's how to tie slime completion into hippie-expand.

    Update: as of 2012, nrepl, nrepl.el and ac-nrepl are replacing slime and ac-slime; same functionality, smaller and cleaner codebase.

    Update2: as of Oct 2013 nrepl.el is renamed to cider and it and ac-nrepl have moved to the clojure-emacs organisation on github. nrepl remains as the server component