From 22a17046e5aed40366881e7d2a66355597937f21 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Fri, 14 Oct 2022 17:43:47 -0700 Subject: ref(python): use black when available Use python3 for the interpreter. Change-Id: Ib3193cb73b1303de543d8dc1873f1efe2320cd20 --- emacs/custom/my-lang-python.el | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'emacs') diff --git a/emacs/custom/my-lang-python.el b/emacs/custom/my-lang-python.el index 74da80b..c5f612a 100644 --- a/emacs/custom/my-lang-python.el +++ b/emacs/custom/my-lang-python.el @@ -5,11 +5,15 @@ ;;; Code: +(require 'python) (require 'python-mode) -(require 'blacken) -;; enable black when we are in python-mode -(add-hook 'python-mode-hook 'blacken-mode) +;; if black is present, enable it +(when (executable-find "black") + (require 'blacken) + (add-hook 'python-mode-hook 'blacken-mode)) + +(setq python-shell-interpreter "python3") (provide 'my-lang-python) -- cgit 1.4.1