lang/python: fix conda/virtualenv modeline segment

Reported by @ztlevi
This commit is contained in:
Henrik Lissner 2019-03-04 20:48:52 -05:00
parent 5bae67e299
commit f515bf5931
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
2 changed files with 30 additions and 3 deletions

View file

@ -52,6 +52,16 @@ called.")
sp-point-after-word-p
sp-point-before-same-p))
(defun +python|detect-local-python-executable ()
(let ((path (+python-executable-find "python")))
(when path
(make-local-variable 'exec-path)
(add-to-list 'exec-path path))
(when (bound-and-true-p doom-modeline-mode)
(setq-local doom-modeline-python-executable
(or path python-shell-interpreter)))))
(add-hook 'python-mode-hook #'+python|detect-local-python-executable)
(setq-hook! 'python-mode-hook tab-width python-indent-offset))