Compare commits

..

No commits in common. "8089cc8f1b21380a570fd3129cb67bd4bcbf1954" and "1ea372e6454dbb2f040b718c0bb5cdd767c46762" have entirely different histories.

View File

@ -1085,7 +1085,6 @@
:config :config
(setf (alist-get 'djlint apheleia-formatters) '("djlint" "--reformat" "-")) (setf (alist-get 'djlint apheleia-formatters) '("djlint" "--reformat" "-"))
(setf (alist-get "\\.dj\\.html$" apheleia-mode-alist) '(djlint)) (setf (alist-get "\\.dj\\.html$" apheleia-mode-alist) '(djlint))
(setf (alist-get 'objc-mode apheleia-mode-alist) 'clang-format)
(defun apheleia--pyproject-contains-section (section) (defun apheleia--pyproject-contains-section (section)
(when-let (parent (locate-dominating-file default-directory "pyproject.toml")) (when-let (parent (locate-dominating-file default-directory "pyproject.toml"))
@ -1095,18 +1094,18 @@
(defun apheleia--check-formatter-configured () (defun apheleia--check-formatter-configured ()
"Disable apheleia when a formatter's configuration does not exist" "Disable apheleia when a formatter's configuration does not exist"
(let ((formatters (apheleia--get-formatters))) (not (let ((formatters (apheleia--get-formatters)))
(cond (cond
((member 'ruff formatters) (not (apheleia--pyproject-contains-section "tool.ruff"))) ((member 'ruff formatters) (apheleia--pyproject-contains-section "tool.ruff"))
((member 'black formatters) (not (apheleia--pyproject-contains-section "tool.black"))) ((member 'black formatters) (apheleia--pyproject-contains-section "tool.black"))
((member 'djlint formatters) (not (apheleia--pyproject-contains-section "tool.djlint"))) ((member 'djlint formatters) (apheleia--pyproject-contains-section "tool.djlint"))
((seq-some (lambda (f) (string-prefix-p "prettier" (symbol-name f))) formatters) ((seq-some (lambda (f) (string-prefix-p "prettier" (symbol-name f))) formatters)
(not (when (= 0 (call-process "prettier" nil nil nil "--find-config-path" (buffer-file-name))) (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)))) (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))) (default-directory (file-name-directory (expand-file-name config-file)))
(file-info (shell-command-to-string (concat "prettier --file-info " (buffer-file-name)))) (file-info (shell-command-to-string (concat "prettier --file-info " (buffer-file-name))))
(file-ignored (gethash "ignored" (json-parse-string file-info)))) (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) (add-to-list 'apheleia-inhibit-functions 'apheleia--check-formatter-configured)