From e6f8eb65d7848ad6c1aacb3365321a76f422221c Mon Sep 17 00:00:00 2001 From: Martin Indra Date: Mon, 7 May 2018 14:09:33 +0200 Subject: [PATCH] Emacs: isort Python imports on save --- README.md | 2 +- emacs/init.el | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0f1cb53..0ef795f 100644 --- a/README.md +++ b/README.md @@ -93,7 +93,7 @@ Python ```bash sudo apt-get install python-pip # these makes Emacs Elpy more powerful -sudo pip install rope importmagic yapf flake8 +sudo pip install rope importmagic yapf flake8 isort ``` Tmux diff --git a/emacs/init.el b/emacs/init.el index adc3d58..8418b6d 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -215,7 +215,12 @@ :ensure t :demand t :config - (add-hook 'python-mode-hook (lambda () (sphinx-doc-mode t))))) + (add-hook 'python-mode-hook (lambda () (sphinx-doc-mode t)))) + (use-package py-isort + :ensure t + :demand t + :config + (add-hook 'before-save-hook 'py-isort-before-save))) (use-package rust-mode :ensure t