Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple sessions at the same time #96

Open
mankoff opened this issue Nov 5, 2021 · 2 comments
Open

Multiple sessions at the same time #96

mankoff opened this issue Nov 5, 2021 · 2 comments

Comments

@mankoff
Copy link

mankoff commented Nov 5, 2021

I seem to have conda.el working well for one Python session at a time. Is it possible to configure conda.el to support multiple sessions?

I'd like to open proj.py in folder proj that uses ENV1. Maybe start a Python session. Maybe not. Then also open proj.py (same file name?) in folder proj (same folder name? Different path?) that uses ENV2. Then from either proj.py start Python, and toggle between them, and have each running in their own inferior *Python-ENV* buffer.

Is this possible with conda.el?

@benbovy
Copy link
Contributor

benbovy commented Nov 19, 2021

FWIW, I have a function in my config that auto-switches the activated conda environment at the workspace level (I'm using persp-mode):

(defun +workspaces-save-conda-env (&rest _args)
  ;; Save current conda environment to a persp parameter
  (set-persp-parameter 'conda-env conda-env-current-name)
  )

(defun +workspaces-activate-conda-env (&rest _)
  ;; Restore and activate conda environment
  (conda-env-deactivate)
  (when-let* ((state (persp-parameter 'conda-env)))
    (conda-env-activate (persp-parameter 'conda-env))
    ))

(add-hook 'persp-before-deactivate-functions #'+workspaces-save-conda-env)
(add-hook 'persp-activated-functions #'+workspaces-activate-conda-env)

I guess it would be possible to have something like that at the buffer level?

@necaris
Copy link
Owner

necaris commented Nov 21, 2021

conda-env-autoactivate-mode should do this, but we don't handle the multiple Python sessions -- the inferior Python is handled separately and isn't conda env aware yet. Would love a PR or help making this happen, though!

@necaris necaris changed the title Can I have multiple Python sessions at the same time? Multiple sessions at the same time Jun 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants