From b2f67e84ee906baff110ce25813eb6014c5d899e Mon Sep 17 00:00:00 2001 From: Ohad Livne Date: Tue, 24 Jun 2025 14:27:06 +0300 Subject: [PATCH] Pick up local variables before starting the Python IDE --- .config/emacs/init.el | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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