6

Is it possible to view Clojure function documentation in Emacs? Namely, can I configure Emacs to lookup Clojure functions under the cursor?

I'm using clojure-mode and SLIME. Oddly, I can't even use apropos or dir in SLIME's repl, although they're automatically loaded by lein repl.

3 Answers 3

5

Try the function slime-describe-symbol, which is usually bound to C-c C-d d.

Place the point somewhere near the function name and hit C-c, then C-d, and then d.

There's also slime-describe-function, bound to C-c C-d f, but I rarely use it, as it's less general than the aforementioned symbol-related lookup function.

To see all the documentation-related functions, press C-c C-d C-h. These bindings are not specific to Clojure; they are instead defined by SLIME, and will work as well if not better for other Lisp dialects.

Sign up to request clarification or add additional context in comments.

2 Comments

<kbd>C-c C-d C-d</kbd> is an alias for <kbd>C-c C-d d</kbd> and is easier to hit as you don't have to release the <kbd>Ctrl</kbd> key at the right moment.
True. By now, I have the muscle memory built up to use the other sequence naturally. I think it comes from associating C-c C-d with the documentation dispatch prefix, stopping at that point to think of which documentation I want, and then preceding with the final character. Hence, letting go of the Control key corresponds to pausing to decide.
3

I find the combination of slime-apropos and eldoc minor mode (make sure you have swank-clojure 1.4.0 as it fixes both of those) better than the slime-describe-symbol/function commands mentioned above.

Comments

2

From SLIME REPL you can run (use 'clojure.repl). This will make functions like apropos and doc available

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.