From 04a1fd855582bd402da5986ef967559f9ba67fcc Mon Sep 17 00:00:00 2001 From: 10sr <8.slashes@gmail.com> Date: Mon, 13 Jan 2020 00:48:50 +0900 Subject: [PATCH] Use advice for my-isortify --- emacs.el | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/emacs.el b/emacs.el index 47e4525..be8d006 100644 --- a/emacs.el +++ b/emacs.el @@ -1414,19 +1414,21 @@ found, otherwise returns nil." (when (require 'with-venv nil t) (with-venv-advice-add 'blacken-buffer))) -;; isortify-buffer breaks buffer when it contains japanese text +;; `isortify-buffer' breaks buffer when it contains japanese text (defun my-isortify () (interactive) (cl-assert buffer-file-name) (cl-assert (not (buffer-modified-p))) - (with-venv - (call-process "python" ;; PROGRAM - nil ;; INFILE - nil ;; DESTINATION - nil ;; DISPLAY - "-m" "isort" buffer-file-name)) + (call-process "python" ;; PROGRAM + nil ;; INFILE + nil ;; DESTINATION + nil ;; DISPLAY + "-m" "isort" buffer-file-name) (message "isortify done") (revert-buffer nil t)) +(when (fboundp 'with-venv-advice-add) + ;; TODO: Lazy load with-venv + (with-venv-advice-add 'my-isortify)) ;; https://github.com/lunaryorn/old-emacs-configuration/blob/master/lisp/flycheck-virtualenv.el (defun my-set-venv-flycheck-executable-find ()