From 36a16936103f5a6d5ee762bfcbcbf71d6c92b5f9 Mon Sep 17 00:00:00 2001 From: Daniel Borchmann Date: Sat, 24 Apr 2021 09:42:33 +0200 Subject: [PATCH] Automatically restart python interpreters when switching virtualenvs This apparantely does not work when simply deactivating the current virtual environment, though. --- init.el | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/init.el b/init.el index 04dcece..5fc294f 100644 --- a/init.el +++ b/init.el @@ -3005,7 +3005,12 @@ With given ARG, display files in `db/important-document-path’." (use-package pyvenv :ensure t :commands (pyvenv-workon pyvenv-activate) - :init (setenv "WORKON_HOME" (expand-file-name "~/.pyenv/versions"))) + :init (setenv "WORKON_HOME" (expand-file-name "~/.pyenv/versions")) + :config (progn + ;; Restart python inferior processes when switching virtual + ;; environments; this does not work when only calling + ;; `pyvenv-deactivate', though. + (add-hook 'pyvenv-post-activate-hooks #'pyvenv-restart-python))) (use-package shr :init (setq shr-use-fonts nil