From 0a577f3a0e5752f409acaef342dac6ea95204573 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Fri, 6 Jul 2018 23:56:50 +0200 Subject: [PATCH] lang/python: fix pyenv version detection #736 --- modules/lang/python/config.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/lang/python/config.el b/modules/lang/python/config.el index 10630b08e..69521d61a 100644 --- a/modules/lang/python/config.el +++ b/modules/lang/python/config.el @@ -67,14 +67,14 @@ is loaded.") (add-hook 'python-mode-hook #'+python|add-version-to-modeline) (if (not (executable-find "pyenv")) - (setq +python-current-version (string-trim (shell-command-to-string "python --version 2>&1 | cut -d' ' -f2"))) + (setq-default +python-current-version (string-trim (shell-command-to-string "python --version 2>&1 | cut -d' ' -f2"))) (setq +python-pyenv-root (string-trim (shell-command-to-string "pyenv root")) +python-pyenv-versions (split-string (shell-command-to-string "pyenv versions --bare") "\n" t)) (defun +python|detect-pyenv-version () "Detect the pyenv version for the current project and set the relevant environment variables." - (when-let* ((version-str (shell-command-to-string "python --version 2>&1 | cut -d' ' -f2"))) + (when-let* ((version-str (shell-command-to-string "PYENV_VERSION= python --version 2>&1 | cut -d' ' -f2"))) (setq version-str (string-trim version-str) +python-current-version version-str) (let ((pyenv-current-path (concat +python-pyenv-root "/versions/" version-str)))