summary refs log tree commit diff
diff options
context:
space:
mode:
authorFranck Cuny <franck@fcuny.net>2022-10-14 17:43:47 -0700
committerFranck Cuny <franck@fcuny.net>2022-10-14 17:43:47 -0700
commit22a17046e5aed40366881e7d2a66355597937f21 (patch)
tree697c65d6124179b11121dc6416a931ee1a61b135
parentref(org-mode): drop references to notmuch (diff)
downloademacs.d-22a17046e5aed40366881e7d2a66355597937f21.tar.gz
ref(python): use black when available
Use python3 for the interpreter.

Change-Id: Ib3193cb73b1303de543d8dc1873f1efe2320cd20
-rw-r--r--emacs/custom/my-lang-python.el10
1 files changed, 7 insertions, 3 deletions
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)