Document Emacs usage in README.md

This commit is contained in:
Tassilo Horn 2012-05-31 15:38:50 +02:00
parent abf4979a0f
commit 3a2e85200a

View file

@ -26,6 +26,31 @@ Then you can run
to analyze your namespaces.
### Usage from inside Emacs
If you use Emacs for hacking Clojure, here's a way to use kibit from inside
Emacs with all the fancyness you are used from `M-x compile`. Put the
following into your `~/.emacs`:
```
;; Teach compile the syntax of the kibit output
(require 'compile)
(add-to-list 'compilation-error-regexp-alist-alist
'(kibit "At \\([^:]+\\):\\([[:digit:]]+\\):" 1 2 nil 0))
(add-to-list 'compilation-error-regexp-alist 'kibit)
;; A convenient command to run "lein kibit" in the project to which the current
;; emacs buffer belongs to.
(defun kibit ()
"Run kibit on the current project.
Display the results in a hyperlinked *compilation* buffer."
(interactive)
(compile "lein kibit"))
```
This will give you a new command `M-x kibit RET`, and the properly highlighted
and hyperlinked kibit output is presented in a `*compilation*` buffer.
## Contributing
It is very easy to write new patterns for `kibit`. Take a look at