Clojuredocs.el from within emacs
Up untill now I have been writing clojure without looking at the documentation. To look at the documentation, I typically always want to go to clojuredocs.org
But hitting K
(in evil-mode) gives me the basic clojure function documentation which leaves a lot to be desired.
So like a pleb, I open the browser. Go to https://clojuredocs.org and then search for my function. Sometimes I directly search in ddg.
So I thought to myself, “Wait a minute…”, can I speed up this flow?
The first thing I did was installed devdocs.el
hoping it would have clojuredocs as a source but it didn’t.
(use-package devdocs)
Next I thought I could quickly write a small function to download clojuredocs via an API and then create a popup buffer containing all the examples?
And so that’s what I did: https://github.com/oxalorg/clojuredocs.el
So first I call M-x clojuredocs-download
to download the json file. And then M-x clojuredocs-lookup
and it gives me with a nice completion minibuffer like so:
and because of using vertico
and orderless
, I can search over the entire namespace + fn-name
selecting a function will open the docs with examples in a buffer:
and the BEST part? It’s a clojure buffer. So you can actually evaluate those examples. change them and re-eval (as long as you have a clojure repl open).
So what are you waiting for? Try it out now, installation instructions in the README: https://github.com/oxalorg/clojuredocs.el
NOTE: I realised this much later, but there is also a cider
integration with clojuredocs. And you can call it with cider-clojuredocs
where you need to manually type out a function which isn’t as cool as searching for it. It’s definitely more polished, and I might look into it more if I can integrate it in my workflow!