From 4a00508f8a09c6fb3b284627b65624a2f9a46916 Mon Sep 17 00:00:00 2001 From: jdlugosz963 Date: Fri, 12 Aug 2022 23:41:53 +0200 Subject: Add auto activate python virtual env --- Emacs.org | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Emacs.org b/Emacs.org index af614a4..8605870 100644 --- a/Emacs.org +++ b/Emacs.org @@ -446,8 +446,15 @@ #+begin_src emacs-lisp + (defun jd/python-mode-setup () + (let ((project-venv-path (concat (projectile-project-root) "venv/"))) + (when (projectile--directory-p project-venv-path) + (pyvenv-activate project-venv-path) + (pyvenv-mode)))) + (use-package python-mode - :hook (python-mode . lsp-deferred)) + :hook (python-mode . lsp-deferred) + :hook (python-mode . jd/python-mode-setup)) (use-package pyvenv :after python-mode) -- cgit v1.2.3