From a6414f45ed1db4f6295dc7cd7471a3d7681cadf0 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 4f4eddb..fce4586 100644 --- a/conda.el +++ b/conda.el @@ -208,9 +208,9 @@ See https://github.com/conda/conda/blob/master/CHANGELOG.md#484-2020-08-06." "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 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)))) @@ -476,6 +476,12 @@ Returns a list of new path elements." ;; 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."