Closed AirManH closed 3 years ago
I did some debugging and found out what caused this error.
As the code shown below, in the line 190, the statement (with-current-buffer standard-output
in function conda--get-path-prefix
will override the buffer local variable conda-anaconda-home
.
https://github.com/necaris/conda.el/blob/9f7eea16e9ad3eb34fe3d1cbd9d6162b8046c2f8/conda.el#L185-L197
If you change the code into this:
(defun conda--get-path-prefix (env-dir)
"Get a platform-specific path string to utilize the conda env in ENV-DIR.
It's platform specific in that it uses the platform's native path separator."
(message "%s" conda-anaconda-home) ;;; <========= /home/user/programs/miniconda3/
(s-trim
(with-output-to-string
(with-current-buffer standard-output
(let* ((conda-executable-path
(concat (file-name-as-directory conda-anaconda-home)
(file-name-as-directory conda-env-executables-dir)
"conda"))
(tmp (message "%s" conda-anaconda-home)) ;;; <========= /home/user/.anaconda3/
The first message
prints: /home/user/programs/miniconda3/
, and the second prints: /home/user/.anaconda3/
@AirManH thanks for the report and the debugging! It looks like capturing the current value of conda-anaconda-home
outside the with-current-buffer
block will fix this -- any interest in submitting a PR?
If I set
conda-anaconda-home
as a buffer local variable,conda-env-activate
can not activate the correct conda env.Steps to reproduce the problem
Configuration
In
init file
:My python project is organized as:
In
.dir-locals.el
:Operations
main.py
M-x conda-env-activate
, choose environmentbase
,enter
*Message*
buffer shows:Specifications