From 72ebde8d3857a76e22b37c09285dcfc557afb17f Mon Sep 17 00:00:00 2001 From: Chris Rose Date: Sun, 5 Nov 2023 09:15:59 -0800 Subject: [PATCH] Add instructions for configuration of Emacs (#8488) ## Summary Add editor integration docs for `ruff format` in Emacs by way of the Apheleia formatter library Depends on: https://github.com/radian-software/apheleia/issues/233 --- docs/integrations.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/integrations.md b/docs/integrations.md index 398a2078e7..9f14681acc 100644 --- a/docs/integrations.md +++ b/docs/integrations.md @@ -331,6 +331,13 @@ Ruff is available as [`flymake-ruff`](https://melpa.org/#/flymake-ruff) on MELPA (add-hook 'python-mode-hook #'flymake-ruff-load) ``` +Ruff can be used as a formatter in Emacs using the [Apheleia](https://github.com/radian-software/apheleia) formatter library, by setting this configuration: + +```emacs-lisp +(add-to-list 'apheleia-mode-alist '(python-mode . ruff)) +(add-to-list 'apheleia-mode-alist '(python-ts-mode . ruff)) +``` + ## TextMate (Unofficial) Ruff is also available via the [`textmate2-ruff-linter`](https://github.com/vigo/textmate2-ruff-linter)