jorgenschaefer / pyvenv

Python virtual environment interface for Emacs
364 stars 57 forks source link

Have `pyvenv-workon` do nothing if the requested environment is already active #81

Open abingham opened 6 years ago

abingham commented 6 years ago

Many of my projects have a .dir-locals.el that does something like this:

((nil . ((eval . (unless (and (boundp 'pyvenv-virtual-env-name) (equal pyvenv-virtual-env-name "my-project"))
                   (pyvenv-workon "my-project")))
         )))

I do this check because apparently magit opens a lot of buffers in some of its operations, and simply callinv pyvenv-workon in dir-locals made magit very, very slow.

Could we add a flag to pyvenv-workon that did something like this, i.e. do nothing if the requested environment is active? I'd be happy to do the work.

jorgenschaefer commented 6 years ago

Hm. Considering you can reset the environment using deactivate + workon, I think this is fine. If you want to do the work, please go ahead! :-)

abingham commented 6 years ago

Excellent. I might even be able to get to it this weekend.