Skip to content

Commit

Permalink
Add conda-reload-config helper
Browse files Browse the repository at this point in the history
  • Loading branch information
necaris committed Oct 5, 2024
1 parent 0fe78a8 commit a6414f4
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions conda.el
Original file line number Diff line number Diff line change
Expand Up @@ -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))))
Expand Down Expand Up @@ -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."
Expand Down

0 comments on commit a6414f4

Please sign in to comment.