fix(python): type error on loading conda.el

When conda.el evaluates `conda-anaconda-home's initial value, and none
of `conda-home-candidates` exist on the user's system, `nil` will be
passed to `expand-file-name`, which requires a string argument, thus
throwing a type error, so we've got to set `conda-anaconda-home` to nil
to prevent it, then reinvent the wheel later.

This should be resolved upstream, but conda.el hasn't been updated in
some time...

Fix: #7283
This commit is contained in:
Henrik Lissner 2024-09-02 00:37:55 -04:00
parent 816db4a62a
commit 8f60a1bc46
No known key found for this signature in database
GPG key ID: B60957CA074D39A3

View file

@ -259,16 +259,14 @@
(use-package! conda (use-package! conda
:when (modulep! +conda) :when (modulep! +conda)
:after python :after python
:config :preface
;; The location of your anaconda home will be guessed from a list of common ;; HACK: `conda-anaconda-home's initialization can throw an error if none of
;; possibilities, starting with `conda-anaconda-home''s default value (which ;; `conda-home-candidates' exist, so unset it early.
;; will consult a ANACONDA_HOME envvar, if it exists). ;; REVIEW: Fix this upstream.
;; (setq conda-anaconda-home nil
;; If none of these work for you, `conda-anaconda-home' must be set conda-home-candidates
;; explicitly. Afterwards, run M-x `conda-env-activate' to switch between (list "~/.anaconda"
;; environments "~/.anaconda3"
(or (cl-loop for dir in (list conda-anaconda-home
"~/.anaconda"
"~/.miniconda" "~/.miniconda"
"~/.miniconda3" "~/.miniconda3"
"~/.miniforge3" "~/.miniforge3"
@ -280,7 +278,16 @@
"/usr/local/anaconda3" "/usr/local/anaconda3"
"/usr/local/miniconda3" "/usr/local/miniconda3"
"/usr/local/Caskroom/miniconda/base" "/usr/local/Caskroom/miniconda/base"
"~/.conda") "~/.conda"))
:config
;; The location of your anaconda home will be guessed from a list of common
;; possibilities, starting with `conda-anaconda-home''s default value (which
;; will consult a ANACONDA_HOME envvar, if it exists).
;;
;; If none of these work for you, `conda-anaconda-home' must be set
;; explicitly. Afterwards, run M-x `conda-env-activate' to switch between
;; environments
(or (cl-loop for dir in (cons conda-anaconda-home conda-home-candidates)
if (file-directory-p dir) if (file-directory-p dir)
return (setq conda-anaconda-home (expand-file-name dir) return (setq conda-anaconda-home (expand-file-name dir)
conda-env-home-directory (expand-file-name dir))) conda-env-home-directory (expand-file-name dir)))