From d6348d3103142e9825ff548d225d9a5bd7cd8f3b Mon Sep 17 00:00:00 2001 From: Rami Chowdhury Date: Sun, 6 Nov 2022 20:11:36 -0500 Subject: [PATCH] Add `conda-reload-config` helper --- conda.el | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/conda.el b/conda.el index dfd1b80..c4bfc87 100644 --- a/conda.el +++ b/conda.el @@ -178,9 +178,9 @@ ANACONDA_HOME environment variable." "Cached copy of configuration that Conda sees (including `condarc', etc). Set for the lifetime of the process.") -(defun conda--get-config() - "Return current Conda configuration. Cached for the lifetime of the process." - (if (not (eq conda--config nil)) +(defun conda--get-config (&optional force-reload) + "Return current Conda configuration. Cached for the process' lifetime, unless FORCE-RELOAD." + (if (and (not force-reload) (not (eq conda--config nil))) conda--config (let ((cfg (conda--call-json "config" "--show" "--json"))) (setq conda--config cfg)))) @@ -418,6 +418,12 @@ Set for the lifetime of the process.") ;; potentially interactive user-exposed functions +(defun conda-reload-config () + "Force-reloads the Conda configuration and displays it." + (interactive) + (let ((cfg (conda--get-config t))) + (message cfg))) + ;;;###autoload (defun conda-env-deactivate () "Deactivate the current conda env."