 ;;; lang/python/config.el -*- lexical-binding: t; -*-
 
-(defvar +python-version-functions '(+python-version)
-  "A list of functions to retrieve a version or environment string from. The
-first to return non-nil will have its result appended to the python-mode
-`mode-name' and displayed in the mode-line.")
+(defvar +python-mode-line-indicator
+  '("Python" (+python-version (" " +python-version)))
+  "Format for the python version/env indicator in the mode-line.")
+
+(defvar-local +python-version nil
+  "The python version in the current buffer.")
 
 
 ;;

  :after python
  :config
  (pyenv-mode +1)
  (advice-add #'pyenv-mode-set :after #'+python*update-version)
  (advice-add #'pyenv-mode-unset :after #'+python*update-version)
  (add-to-list '+python-version-functions #'pyenv-mode-version nil #'eq))



  (defun +python-current-pyvenv () pyvenv-virtual-env-name)
  (add-hook 'pyvenv-post-activate-hooks #'+python|update-version)
  (add-hook 'pyvenv-post-deactivate-hooks #'+python|update-version)
  (add-to-list '+python-mode-line-indicator '(pyvenv-virtual-env-name (" venv:" pyvenv-virtual-env-name)) 'append)
  (add-to-list '+python-version-functions #'+python-current-pyvenv nil #'eq))


