diff --git a/.config/emacs/init.el b/.config/emacs/init.el index 5ef9ea5..1ea3726 100644 --- a/.config/emacs/init.el +++ b/.config/emacs/init.el @@ -243,16 +243,17 @@ (defun load-python-env () "Set up the Python IDE in the current project." (interactive) - (progn - (ignore-errors (poetry-venv-workon)) - (eglot-ensure))) + (when (derived-mode-p 'python-mode) + (progn + (poetry-venv-workon) + (eglot-ensure)))) (use-package python :bind (:map python-mode-map ("C-c C-p" . nil) ("C-c C-l" . nil) ("C-c t" . elpy-test)) - :hook (python-mode . load-python-env) + :hook (hack-local-variables . load-python-env) :config (load "python-tests.el") :custom