From acc01baff5d295c3ada79da191473f24e43c3705 Mon Sep 17 00:00:00 2001 From: Michael Herstine Date: Sat, 29 Jul 2023 10:07:34 -0700 Subject: Update the README with more recent instructions 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). -- cgit v1.2.3