diff options
Diffstat (limited to '.emacs.d/lisp/init-python.el')
-rw-r--r-- | .emacs.d/lisp/init-python.el | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/.emacs.d/lisp/init-python.el b/.emacs.d/lisp/init-python.el new file mode 100644 index 0000000..646251f --- /dev/null +++ b/.emacs.d/lisp/init-python.el @@ -0,0 +1,20 @@ +(when (gx/maybe-require-package 'eglot) + (add-hook 'python-mode-hook #'eglot-ensure)) + +;; TODO Check if the venv-directory exists. +;; Raise error message if it doesn't. +(defun gx/python-load-venv () + "" + (setenv "WORKON_HOME" (projectile-project-root)) + (let* ((project-root (projectile-project-root)) + (venv-directory "venv")) + (setenv "WORKON_HOME" project-root) + (pyvenv-workon venv-directory))) + + +(when (gx/maybe-require-package 'pyvenv) + (autoload #'pyvenv-activate "pyvenv" nil t) + (autoload #'pyvenv-workon "pyvenv" nil t) + (add-hook 'python-mode-hook #'gx/python-load-venv)) + +(provide 'init-python) |