From 8f60a1bc46b3b1ef7987aa85764f35ee2249721d Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Mon, 2 Sep 2024 00:37:55 -0400 Subject: [PATCH] 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 --- modules/lang/python/config.el | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/modules/lang/python/config.el b/modules/lang/python/config.el index a44b56011..b307f72bd 100644 --- a/modules/lang/python/config.el +++ b/modules/lang/python/config.el @@ -259,6 +259,26 @@ (use-package! conda :when (modulep! +conda) :after python + :preface + ;; HACK: `conda-anaconda-home's initialization can throw an error if none of + ;; `conda-home-candidates' exist, so unset it early. + ;; REVIEW: Fix this upstream. + (setq conda-anaconda-home nil + conda-home-candidates + (list "~/.anaconda" + "~/.anaconda3" + "~/.miniconda" + "~/.miniconda3" + "~/.miniforge3" + "~/anaconda3" + "~/miniconda3" + "~/miniforge3" + "~/opt/miniconda3" + "/usr/bin/anaconda3" + "/usr/local/anaconda3" + "/usr/local/miniconda3" + "/usr/local/Caskroom/miniconda/base" + "~/.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 @@ -267,20 +287,7 @@ ;; 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 (list conda-anaconda-home - "~/.anaconda" - "~/.miniconda" - "~/.miniconda3" - "~/.miniforge3" - "~/anaconda3" - "~/miniconda3" - "~/miniforge3" - "~/opt/miniconda3" - "/usr/bin/anaconda3" - "/usr/local/anaconda3" - "/usr/local/miniconda3" - "/usr/local/Caskroom/miniconda/base" - "~/.conda") + (or (cl-loop for dir in (cons conda-anaconda-home conda-home-candidates) if (file-directory-p dir) return (setq conda-anaconda-home (expand-file-name dir) conda-env-home-directory (expand-file-name dir)))