From 3091331107c99f2fe73c5319ef75ac2ee2923e13 Mon Sep 17 00:00:00 2001 From: Adam Goldsmith Date: Fri, 31 May 2024 14:03:33 -0400 Subject: [PATCH] Fix `apheleia--check-formatter-configured` for unrelated formatters --- .emacs.d/init.el | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.emacs.d/init.el b/.emacs.d/init.el index ccc271a..0fe46e3 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -1094,18 +1094,18 @@ (defun apheleia--check-formatter-configured () "Disable apheleia when a formatter's configuration does not exist" - (not (let ((formatters (apheleia--get-formatters))) + (let ((formatters (apheleia--get-formatters))) (cond - ((member 'ruff formatters) (apheleia--pyproject-contains-section "tool.ruff")) - ((member 'black formatters) (apheleia--pyproject-contains-section "tool.black")) - ((member 'djlint formatters) (apheleia--pyproject-contains-section "tool.djlint")) + ((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"))) ((seq-some (lambda (f) (string-prefix-p "prettier" (symbol-name f))) formatters) - (when (= 0 (call-process "prettier" nil nil nil "--find-config-path" (buffer-file-name))) + (not (when (= 0 (call-process "prettier" nil nil nil "--find-config-path" (buffer-file-name))) (let* ((config-file (shell-command-to-string (concat "prettier --find-config-path " (buffer-file-name)))) (default-directory (file-name-directory (expand-file-name config-file))) (file-info (shell-command-to-string (concat "prettier --file-info " (buffer-file-name)))) (file-ignored (gethash "ignored" (json-parse-string file-info)))) - (eq file-ignored :false)))))))) + (eq file-ignored :false))))))))) (add-to-list 'apheleia-inhibit-functions 'apheleia--check-formatter-configured)