diff options
author | jdlugosz963 <jdlugosz963@gmail.com> | 2022-08-12 23:41:53 +0200 |
---|---|---|
committer | jdlugosz963 <jdlugosz963@gmail.com> | 2022-08-12 23:41:53 +0200 |
commit | 4a00508f8a09c6fb3b284627b65624a2f9a46916 (patch) | |
tree | c576560793759bd8f3f1fb75885142d40376d884 | |
parent | af0b9428baeb74bea8e24383f3e8b7169108b40d (diff) | |
download | dotfiles-4a00508f8a09c6fb3b284627b65624a2f9a46916.tar.gz dotfiles-4a00508f8a09c6fb3b284627b65624a2f9a46916.zip |
Add auto activate python virtual env
-rw-r--r-- | Emacs.org | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -446,8 +446,15 @@ | |||
446 | 446 | ||
447 | #+begin_src emacs-lisp | 447 | #+begin_src emacs-lisp |
448 | 448 | ||
449 | (defun jd/python-mode-setup () | ||
450 | (let ((project-venv-path (concat (projectile-project-root) "venv/"))) | ||
451 | (when (projectile--directory-p project-venv-path) | ||
452 | (pyvenv-activate project-venv-path) | ||
453 | (pyvenv-mode)))) | ||
454 | |||
449 | (use-package python-mode | 455 | (use-package python-mode |
450 | :hook (python-mode . lsp-deferred)) | 456 | :hook (python-mode . lsp-deferred) |
457 | :hook (python-mode . jd/python-mode-setup)) | ||
451 | 458 | ||
452 | (use-package pyvenv | 459 | (use-package pyvenv |
453 | :after python-mode) | 460 | :after python-mode) |