forked from colonelpanic/dotfiles
[Emacs] Add autoflake and isort
This commit is contained in:
parent
21505f23f3
commit
03346eeaeb
@ -2171,8 +2171,6 @@ I don't use auto-complete at all, so I have set up a hook to automatically disab
|
|||||||
** apheleia
|
** apheleia
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(use-package apheleia
|
(use-package apheleia
|
||||||
:init
|
|
||||||
(defvar imalison:apheleia-allowed nil)
|
|
||||||
:config
|
:config
|
||||||
(progn
|
(progn
|
||||||
(setq-default apheleia-inhibit t)
|
(setq-default apheleia-inhibit t)
|
||||||
@ -2284,7 +2282,6 @@ I don't use auto-complete at all, so I have set up a hook to automatically disab
|
|||||||
*** python
|
*** python
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(defvar imalison:use-lsp-python t)
|
(defvar imalison:use-lsp-python t)
|
||||||
(defvar imalison:use-black nil)
|
|
||||||
|
|
||||||
(use-package python
|
(use-package python
|
||||||
:commands python-mode
|
:commands python-mode
|
||||||
@ -2293,12 +2290,22 @@ I don't use auto-complete at all, so I have set up a hook to automatically disab
|
|||||||
(defun imalison:python-mode ()
|
(defun imalison:python-mode ()
|
||||||
(add-hook 'hack-local-variables-hook
|
(add-hook 'hack-local-variables-hook
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(when imalison:use-black
|
|
||||||
(setq imalison:apheleia-allowed t))
|
|
||||||
(when imalison:use-lsp-python
|
(when imalison:use-lsp-python
|
||||||
(lsp-deferred))) nil t))
|
(lsp-deferred))) nil t))
|
||||||
:config
|
:config
|
||||||
(progn
|
(progn
|
||||||
|
(use-package apheleia
|
||||||
|
:config
|
||||||
|
(progn
|
||||||
|
(setf (alist-get 'isort apheleia-formatters)
|
||||||
|
'("isort" "--stdout" "-"))
|
||||||
|
(setf (alist-get 'autoflake apheleia-formatters)
|
||||||
|
'("autoflake" "--stdout" "--remove-all-unused-imports"
|
||||||
|
"--ignore-init-module-imports" "-"))
|
||||||
|
(setf (alist-get 'python-mode apheleia-mode-alist)
|
||||||
|
'(autoflake isort black))
|
||||||
|
(setf (alist-get 'python-ts-mode apheleia-mode-alist)
|
||||||
|
(alist-get 'python-mode apheleia-mode-alist))))
|
||||||
(use-package lsp-mode
|
(use-package lsp-mode
|
||||||
:config
|
:config
|
||||||
(progn
|
(progn
|
||||||
|
Loading…
Reference in New Issue
Block a user