A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://lists.gnu.org/archive/html/emacs-devel/2022-11/msg01295.html below:

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] 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



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4