[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Eglot, project.el, and python virtual environments
From: |
Danny Freeman |
Subject: |
Re: Eglot, project.el, and python virtual environments |
Date: |
Sat, 19 Nov 2022 14:17:46 -0500 |
Dmitry Gutov <dgutov@yandex.ru> writes:
> Anyway, this is the problem with the popular recommendation: just add a thing
> to
> 'project-find-functions'. It degrades performance and changes how project
> commands work too.
Does it really change how the project commands work? That is not what I
have seen. The special project-find-functions thing only returns a
value when eglot is calling `project-current`. This only happens from
one function, `eglot--current-project`, which is called infrequently.
All other times that function returns nil so project.el falls back to
`project-try-vc`.
Outside of eglot's one call to `project-current` the special
`project-find-functions` thing is only checking a single var for
truthyness and returning nil. I don't see how it could adversely impact
performance.
For reference this is the code I'm talking about:
```
(defun project-find-virtualenv-for-eglot (dir)
(when eglot-lsp-context ;; ALWAYS NIL, except when called from
`eglot--curent-project`
(let ((root (locate-dominating-file dir ".virtualenv")))
(when root
(cons 'transient root)))))
(add-hook 'project-find-functions #'project-find-virtualenv-for-eglot)
```
--
Danny Freeman
- Re: Eglot, project.el, and python virtual environments, (continued)
- Re: Eglot, project.el, and python virtual environments, Dmitry Gutov, 2022/11/18
- Re: Eglot, project.el, and python virtual environments, Eli Zaretskii, 2022/11/19
- Re: Eglot, project.el, and python virtual environments, Dmitry Gutov, 2022/11/19
- Re: Eglot, project.el, and python virtual environments, Eli Zaretskii, 2022/11/19
Re: Eglot, project.el, and python virtual environments, João Távora, 2022/11/18
- Re: Eglot, project.el, and python virtual environments, Dmitry Gutov, 2022/11/18
- Re: Eglot, project.el, and python virtual environments, João Távora, 2022/11/18
- Re: Eglot, project.el, and python virtual environments, Dmitry Gutov, 2022/11/19
- Re: Eglot, project.el, and python virtual environments,
Danny Freeman <=
- Re: Eglot, project.el, and python virtual environments, Dmitry Gutov, 2022/11/19
- Re: Eglot, project.el, and python virtual environments, Danny Freeman, 2022/11/19
- Re: Eglot, project.el, and python virtual environments, João Távora, 2022/11/19
- Re: Eglot, project.el, and python virtual environments, Dmitry Gutov, 2022/11/20
- Re: Eglot, project.el, and python virtual environments, João Távora, 2022/11/20
- Re: Eglot, project.el, and python virtual environments, Dmitry Gutov, 2022/11/20
- Re: Eglot, project.el, and python virtual environments, João Távora, 2022/11/21
- Re: Eglot, project.el, and python virtual environments, Dmitry Gutov, 2022/11/22
- Re: Eglot, project.el, and python virtual environments, Stefan Monnier, 2022/11/22
- Re: Eglot, project.el, and python virtual environments, João Távora, 2022/11/22