~mgmarlow/public-inbox

Update the README with more recent instructions v1 APPLIED

Michael Herstine: 1
 Update the README with more recent instructions

 1 files changed, 36 insertions(+), 2 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~mgmarlow/public-inbox/patches/43083/mbox | git am -3
Learn more about email & git

[PATCH] Update the README with more recent instructions Export this patch

The README contained two things that were incorrect for my setup
(Emacs from source (30+) and elgot 1.15):

    - `use-package' now has support for fetching from git, albeit
      with different parameters
    - `eglot--managed-mode-hook' was deprecated some time ago (in
      eglot 1.6)-- one should use `eglot-managed-mode-hook' now.

This patch updates the README, preserving the old documentation,
but adding the above information.
---
 README.md | 38 ++++++++++++++++++++++++++++++++++++--
 1 file changed, 36 insertions(+), 2 deletions(-)

diff --git a/README.md b/README.md
index cd48482..7dd3d22 100644
--- a/README.md
+++ b/README.md
@@ -6,7 +6,7 @@ A Flymake backend for [Clippy](https://doc.rust-lang.org/stable/clippy/index.htm

You probably want to install [rust-mode](https://github.com/rust-lang/rust-mode) first.

With Emacs 29:
With Emacs 29 and [vc-use-package](https://github.com/slotThe/vc-use-package):

```elisp
(use-package clippy-flymake
@@ -14,6 +14,14 @@ With Emacs 29:
  :hook (rust-mode . clippy-flymake-setup-backend))
```

With Emacs 30:

``` elisp
(use-package clippy-flymake
  :vc (:url "https://git.sr.ht/~mgmarlow/clippy-flymake" :branch main)
  :hook (rust-mode . clippy-flymake-setup-backend))
```

Alternatively, clone the repo and update your load path:

```
@@ -38,9 +46,11 @@ Eglot users require [a little extra setup](https://github.com/joaotavora/eglot/i
  (add-hook 'flymake-diagnostic-functions #'eglot-flymake-backend nil t)
  (flymake-mode 1))

(add-hook 'eglot--managed-mode-hook #'manually-activate-flymake nil t)
(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':

```
@@ -51,6 +61,8 @@ Running backends: clippy-flymake-backend, eglot-flymake-backend

### Complete eglot + rust-mode + use-package example

Prior to emacs 30 for the `:vc` specification, and prior to eglot 1.6 for the minor mode hook:

```elisp
(use-package rust-mode
  :ensure t)
@@ -71,6 +83,28 @@ Running backends: clippy-flymake-backend, eglot-flymake-backend
  (add-to-list 'eglot-stay-out-of 'flymake))
```

Emacs 30, eglot 1.6+:

```elisp
(use-package rust-mode
  :ensure t)

(use-package clippy-flymake
  :vc (:url "https://git.sr.ht/~mgmarlow/clippy-flymake" :branch main)
  :hook (rust-mode . clippy-flymake-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).
-- 
2.34.1
Thank you for the patch, I've applied it to main.

I had incorrectly thought vc-use-package was shipping with Emacs 29 so 
your updates are very helpful. Unfortunate that there's a breaking API 
change between vc-use-package and the :vc keyword in Emacs main.

Best,
Graham