necaris / conda.el

Emacs helper library (and minor mode) to work with conda environments
MIT License
153 stars 49 forks source link

Test for major mode in `conda--switch-buffer-auto-activate` #75

Closed wtianyi closed 3 years ago

wtianyi commented 3 years ago

Only auto-activate conda env for a buffer if the major mode is python-mode

I like the auto-activation of conda envs when switching buffer. But for non-python project buffers, the conda env often will be nil and cause a warning message. Testing for python-mode when activating a conda env for a buffer may reduce such annoyance.

necaris commented 3 years ago

Could we put this behind an configuration flag? I can't speak for everyone else but I often work entirely within a conda-managed project and it's useful to have my other buffers (particularly terminals & magit) aware of the active conda environment.

wtianyi commented 3 years ago

I agree that conda environment can be useful for non-python-mode buffers as well (just curious, how does magit benefit from it?).

Maybe a project-scope activation-deactivation mechanism is better? Like activating an env has its effect within a project, and buffers outside of the project will not be affected.

necaris commented 3 years ago

(just curious, how does magit benefit from it?)

In my case, I have pre-commit hooks set up that depend on my conda environment :smile:

Maybe a project-scope activation-deactivation mechanism is better? Like activating an env has its effect within a project, and buffers outside of the project will not be affected.

I'd be OK with that -- so long as we don't depend on another external library, would be my preference here. I use projectile, and I'm sure many others do too, but I don't want to make that assumption for everyone.