https://github.com/mgmarlow/flymake-clippy
Flymake backend for Clippy
https://github.com/mgmarlow/flymake-clippy
emacs flymake rust
Last synced: 2 months ago
JSON representation
Flymake backend for Clippy
- Host: GitHub
- URL: https://github.com/mgmarlow/flymake-clippy
- Owner: mgmarlow
- License: gpl-3.0
- Created: 2023-08-08T23:31:11.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-11-02T23:46:19.000Z (over 2 years ago)
- Last Synced: 2025-04-03T22:33:47.407Z (over 1 year ago)
- Topics: emacs, flymake, rust
- Language: Emacs Lisp
- Homepage:
- Size: 29.3 KB
- Stars: 4
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.org
- License: LICENSE
Awesome Lists containing this project
README
# flymake-clippy
[](https://melpa.org/#/flymake-clippy)
A Flymake backend for [Clippy](https://doc.rust-lang.org/stable/clippy/index.html), the Rust linter.
## Instructions
You probably want to install [rust-mode](https://github.com/rust-lang/rust-mode) first.
Install from [MELPA](https://melpa.org/#/getting-started):
``` elisp
(use-package flymake-clippy
:hook (rust-mode . flymake-clippy-setup-backend))
```
Alternatively, clone the repo and update your load path:
```
git clone https://git.sr.ht/~mgmarlow/flymake-clippy /path/to/flymake-clippy
```
```elisp
(add-to-list 'load-path "/path/to/flymake-clippy")
(require 'flymake-clippy)
```
### Eglot users
Eglot users require [a little extra setup](https://github.com/joaotavora/eglot/issues/268) to enable running multiple Flymake backends simultaneously. Add the following to your Emacs config:
```elisp
;; Instruct Eglot to stop managing Flymake
(add-to-list 'eglot-stay-out-of 'flymake)
;; Manually re-enable Eglot's Flymake backend
(defun manually-activate-flymake ()
(add-hook 'flymake-diagnostic-functions #'eglot-flymake-backend nil t)
(flymake-mode 1))
(add-hook 'eglot-managed-mode-hook #'manually-activate-flymake nil t)
```
(Nb. prior to eglot 1.6, this hook was called `eglot--managed-mode-hook)
You can confirm that Flymake is running correctly by opening up a Rust buffer and examining `flymake-running-backends':
```
M-x flymake-running-backends
Running backends: flymake-clippy-backend, eglot-flymake-backend
```
### Complete eglot + rust-mode + use-package example
With Eglot 1.6+:
```elisp
(use-package rust-mode
:ensure t)
(use-package flymake-clippy
:hook (rust-mode . flymake-clippy-setup-backend))
(defun manually-activate-flymake ()
(add-hook 'flymake-diagnostic-functions #'eglot-flymake-backend nil t)
(flymake-mode 1))
(use-package eglot
:ensure t
:hook ((rust-mode . eglot-ensure)
(eglot-managed-mode . manually-activate-flymake))
:config
(add-to-list 'eglot-stay-out-of 'flymake))
```
## Contributing
Please direct bug reports or patches to the [the mailing list](https://lists.sr.ht/~mgmarlow/public-inbox).
## License
Licensed under [GPL-3.0](./LICENSE).