diff --git a/.emacs.d/init.el b/.emacs.d/init.el index 25eade7..5b4e491 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -1073,6 +1073,8 @@ :config (setf (alist-get 'djlint apheleia-formatters) '("djlint" "--reformat" "-")) (setf (alist-get "\\.dj\\.html$" apheleia-mode-alist) '(djlint)) + (setf (alist-get 'pyproject-fmt apheleia-formatters) '("sh" "-c" "pyproject-fmt --no-print-diff -; test $? -le 1")) + (setf (alist-get "/pyproject\\.toml$" apheleia-mode-alist) '(pyproject-fmt)) (setf (alist-get 'objc-mode apheleia-mode-alist) 'clang-format) (defun apheleia--pyproject-contains-section (section) @@ -1085,6 +1087,7 @@ "Disable apheleia when a formatter's configuration does not exist" (let ((formatters (apheleia--get-formatters))) (cond + ((member 'pyproject-fmt formatters) (not (apheleia--pyproject-contains-section "tool.pyproject-fmt"))) ((member 'ruff formatters) (not (apheleia--pyproject-contains-section "tool.ruff"))) ((member 'black formatters) (not (apheleia--pyproject-contains-section "tool.black"))) ((member 'djlint formatters) (not (apheleia--pyproject-contains-section "tool.djlint")))