emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Eglot, project.el, and python virtual environments


From: Stephen Leake
Subject: Re: Eglot, project.el, and python virtual environments
Date: Sat, 19 Nov 2022 14:36:20 -0800
User-agent: Gnus/5.13 (Gnus v5.13)

Eric Abrahamsen <eric@ericabrahamsen.net> writes:

>  Basic project structure
> looks like:
>
> project_root
> ├── .git
> ├── src
> │   └── python
> │       ├── VeryImportantLambda
> │       │   └── .venv
> │       ├── MoreImportance
> │       │   └── .venv
> │       ├── RunInCaseOfEmergency
> │       │   └── .venv
>
>
> Now I'm trying to move to Eglot, and there is tighter integration
> between Eglot and project.el. Turning on Eglot in one lambda starts the
> server for all Python libraries in the whole project, not just the
> current environment. I looked into constructing my own version of the
> call to `eglot', but it is tightly tied to a project, all the way down.
>
> Is anyone else handling this situation? Any suggestions how to make it
> work?

Declare a project.el project for each directory that has a .venv.

I'm guessing you are currently using vc-project, so there is only one,
rooted where the .git directory is.

You do this by writing your own function for project-find-functions;
something like:

(defun my-projects (dir)
 (list 'transient (locate-dominating-file ".venv")))

(add-to-list 'project-find-functions #'my-projects)

You might have to delete vc projects from project-find-functions, or
make it buffer-local; there are lots of choices.

-- 
-- Stephe



reply via email to

[Prev in Thread] Current Thread [Next in Thread]