summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGraham Marlow <graham@onesignal.com>2023-06-13 08:39:15 -0700
committerGraham Marlow <graham@onesignal.com>2023-06-13 08:39:15 -0700
commit96d9fe19012223c0f1f473b62bb7990f64e65400 (patch)
tree3ee426efc44a2d607a83abd0e23591c6f37dfae3
parent6b71a8a82e2102d66f6d5b41dc8a4fdd03f9f8cb (diff)
downloadflymake-clippy-96d9fe19012223c0f1f473b62bb7990f64e65400.tar.gz
Extra docs for eglot users
-rw-r--r--README.md34
1 files changed, 30 insertions, 4 deletions
diff --git a/README.md b/README.md
index 54076d4..8e02c03 100644
--- a/README.md
+++ b/README.md
@@ -8,9 +8,8 @@ Use with [rust-mode](https://elpa.nongnu.org/nongnu/rust-mode.html):
```elisp
(use-package clippy-flymake
- :vc (:fetcher sourcehut :repo mgmarlow/clippy-flymake))
-
-(add-hook 'rust-mode-hook #'clippy-flymake-setup-backend)
+ :vc (:fetcher sourcehut :repo mgmarlow/clippy-flymake)
+ :hook (rust-mode . clippy-flymake-setup-backend))
```
## Eglot users
@@ -18,9 +17,36 @@ Use with [rust-mode](https://elpa.nongnu.org/nongnu/rust-mode.html):
Eglot [fully manages Flymake](https://github.com/joaotavora/eglot/issues/268) so you'll need some extra code to make it cooperate:
```elisp
+;; Instruct Eglot to stop managing Flymake
(add-to-list 'eglot-stay-out-of 'flymake)
+;; Add the Eglot hook to Flymake diagnostic functions so we don't lose Eglot
+;; functionality
(add-hook 'eglot--managed-mode-hook
(lambda ()
- (add-hook 'flymake-diagnostic-functions #'eglot-flymake-backend nil t)))
+ (add-hook 'flymake-diagnostic-functions #'eglot-flymake-backend nil t)
+ (flymake-mode 1)))
+```
+
+### Complete use-package example
+
+```elisp
+(use-package clippy-flymake
+ :vc (:fetcher sourcehut :repo mgmarlow/clippy-flymake)
+ :hook (rust-mode . clippy-flymake-setup-backend))
+
+(use-package eglot
+ :ensure t
+ :hook ((rust-mode . eglot-ensure)
+ (eglot--managed-mode . (lambda ()
+ (add-hook 'flymake-diagnostic-functions #'eglot-flymake-backend nil t)
+ (flymake-mode 1))))
+ :config
+ (add-to-list 'eglot-stay-out-of 'flymake))
+```
+
+You can confirm that Flymake is running correctly by opening up a Rust buffer and examining `flymake-running-backends':
+
+```
+Running backends: clippy-flymake, eglot-flymake-backend
```