Refer to new kibit-helper Emacs package.
This commit is contained in:
parent
eada5a5f42
commit
8762ea558d
1 changed files with 32 additions and 24 deletions
56
README.md
56
README.md
|
@ -112,33 +112,41 @@ instead of:
|
||||||
|
|
||||||
If you use Emacs for hacking Clojure, here's a way to use kibit from
|
If you use Emacs for hacking Clojure, here's a way to use kibit from
|
||||||
inside Emacs with all the fanciness you are used to from `M-x compile`.
|
inside Emacs with all the fanciness you are used to from `M-x compile`.
|
||||||
Put the following into your `~/.emacs`:
|
The [kibit-helper](https://github.com/brunchboy/kibit-helper) package
|
||||||
|
available from [MELPA](http://melpa.org/) provides several handy
|
||||||
|
commands. First, make sure you have MELPA available as a source of
|
||||||
|
packages (which you may well already have done). As described in their
|
||||||
|
[Getting started](http://melpa.org/#/getting-started) section, put the
|
||||||
|
following into your `~/.emacs`:
|
||||||
|
|
||||||
```clojure
|
```elisp
|
||||||
;; Teach compile the syntax of the kibit output
|
(add-to-list 'package-archives
|
||||||
(require 'compile)
|
'("melpa-stable" . "http://stable.melpa.org/packages/") t)
|
||||||
(add-to-list 'compilation-error-regexp-alist-alist
|
|
||||||
'(kibit "At \\([^:]+\\):\\([[:digit:]]+\\):" 1 2 nil 2))
|
|
||||||
(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"))
|
|
||||||
|
|
||||||
(defun kibit-current-file ()
|
|
||||||
"Run kibit on the current file.
|
|
||||||
Display the results in a hyperlinked *compilation* buffer."
|
|
||||||
(interactive)
|
|
||||||
(compile (concat "lein kibit " buffer-file-name)))
|
|
||||||
```
|
```
|
||||||
|
|
||||||
This will give you a new command `M-x kibit RET`, and the properly
|
(If you want to be more on the cutting edge, you can include unreleased
|
||||||
highlighted and hyperlinked kibit output is presented in a
|
versions of packages using the non-stable URL, as explained in the
|
||||||
`*compilation*` buffer.
|
MELPA instructions, but kibit-helper is also available from the less
|
||||||
|
exciting stable repository.)
|
||||||
|
|
||||||
|
This will give you three new commands,
|
||||||
|
|
||||||
|
M-x kibit
|
||||||
|
M-x kibit-current-file
|
||||||
|
M-x kibit-accept-proposed-change
|
||||||
|
|
||||||
|
The first two cause the properly highlighted and hyperlinked kibit output to be
|
||||||
|
presented in a `*Kibit Suggestions*` buffer. The third lets you automatically
|
||||||
|
apply any of those suggestions to your source.
|
||||||
|
|
||||||
|
You will likely want to bind the last function to <kbd>C-x</kbd>
|
||||||
|
<kbd>C-\`</kbd> so it is easy to alternate with the `next-error`
|
||||||
|
function (conventionally <kbd>C-x</kbd> <kbd>\`</kbd>) as you walk
|
||||||
|
through the suggestions made by Kibit:
|
||||||
|
|
||||||
|
```elisp
|
||||||
|
(global-set-key (kbd "C-x C-`") 'kibit-accept-proposed-change)
|
||||||
|
```
|
||||||
|
|
||||||
## Known limitations
|
## Known limitations
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue