mirror of
https://github.com/SqrtMinusOne/micromamba.el.git
synced 2025-12-10 13:23:02 +03:00
Cache micromamba--buffer-env, check file-remote-p
This commit is contained in:
parent
335804a494
commit
f7933808a6
1 changed files with 15 additions and 8 deletions
|
|
@ -202,10 +202,17 @@ Returns an alist with the following keys:
|
|||
(micromamba--get-name-from-env-yml-contents
|
||||
(micromamba--read-file-into-string filename)))))))
|
||||
|
||||
(defvar-local micromamba--buffer-env nil
|
||||
"The environment to autoactivate for the buffer.")
|
||||
|
||||
(defun micromamba--infer-env-from-buffer () ;; adapted from conda.el
|
||||
"Search up the project tree for an `environment.yml` defining a conda env.
|
||||
|
||||
Return `micromamba-fallback-environment' if not found."
|
||||
(if (file-remote-p buffer-file-name)
|
||||
micromamba-fallback-environment
|
||||
(or micromamba--buffer-env
|
||||
(setq micromamba--buffer-env
|
||||
(let* ((filename (buffer-file-name))
|
||||
(working-dir (if filename
|
||||
(file-name-directory filename)
|
||||
|
|
@ -213,7 +220,7 @@ Return `micromamba-fallback-environment' if not found."
|
|||
(when working-dir
|
||||
(or
|
||||
(micromamba--get-name-from-env-yml (micromamba--find-env-yml working-dir))
|
||||
micromamba-fallback-environment))))
|
||||
micromamba-fallback-environment)))))))
|
||||
|
||||
(defun micromamba--get-activation-parameters (prefix)
|
||||
"Get activation parameters for the environment PREFIX.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue