diff --git a/.emacs.d/init.el b/.emacs.d/init.el index fb7ccc7..1ab1640 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -1120,6 +1120,28 @@ :autoload smali-mode :mode "\\.smali\\'") +(use-package pet :demand :if (package-installed-p 'pet) + :delight + :config + (defun pet--python-shell-setup () + (setq-local python-shell-interpreter (pet-executable-find "python") + python-shell-virtualenv-root (pet-virtualenv-root))) + (setq pet-toml-to-json-program "yq" + pet-toml-to-json-program-arguments '("-p" "toml" "-o" "json") + pet-yaml-to-json-program "yq" + pet-yaml-to-json-program-arguments '("-p" "yaml" "-o" "json")) + (add-hook 'python-base-mode-hook 'pet-mode -10) + (add-hook 'python-base-mode-hook 'pet--python-shell-setup) + (add-hook 'python-base-mode-hook 'pet-flycheck-setup) + + (when (boundp 'apheleia-formatters) + (setf (car (alist-get 'black apheleia-formatters)) + '(pet-executable-find "black")) + (setf (car (alist-get 'djlint apheleia-formatters)) + '(pet-executable-find "djlint")) + (setf (car (alist-get 'isort apheleia-formatters)) + '(pet-executable-find "isort")))) + ;;; Local Variables (add-to-list 'safe-local-eval-forms '(outline-hide-body)) ;; Local Variables: