[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/opam-switch-mode 138d42bd56 1/3: feat: Run `opam env --swi
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/opam-switch-mode 138d42bd56 1/3: feat: Run `opam env --switch=$it --set-switch`, so `$OPAMSWITCH` is also set |
Date: |
Thu, 13 Jul 2023 19:00:45 -0400 (EDT) |
branch: elpa/opam-switch-mode
commit 138d42bd56a5504bc40e984f0fb17214524edc87
Author: Erik Martin-Dorel <erik@martin-dorel.org>
Commit: Erik Martin-Dorel <erik@martin-dorel.org>
feat: Run `opam env --switch=$it --set-switch`, so `$OPAMSWITCH` is also set
---
NEWS.md | 2 ++
opam-switch-mode.el | 11 ++++++-----
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/NEWS.md b/NEWS.md
index 746e35890f..6f61b35473 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -10,6 +10,8 @@ The format is based on [Keep a
Changelog](https://keepachangelog.com/en/1.1.0/).
### Added
+- Use command `opam env --switch=$it --set-switch`, so the env var
`$OPAMSWITCH` is also set
+
### Fixed
### Changed
diff --git a/opam-switch-mode.el b/opam-switch-mode.el
index a3d79d2701..51a92d5221 100644
--- a/opam-switch-mode.el
+++ b/opam-switch-mode.el
@@ -100,9 +100,9 @@ background process before the opam switch changes."
&rest args)
"Run opam SUB-CMD, without capturing error output.
Run opam SUB-CMD with additional arguments and insert the output
-in the current buffer at point. Error output (stderr) is
-discarded. If SWITCH is not nil, an option \"--swith=SWITCH\" is
-added. If SEXP is t, option --sexp is added. All remaining
+in the current buffer at point. Error output (stderr) is discarded.
+If SWITCH is not nil, options \"--switch=SWITCH --set-switch\" are
+added. If SEXP is t, option --sexp is added. All remaining
arguments ARGS are added as arguments.
Return exit status of the opam invocation.
@@ -114,7 +114,8 @@ therfore respect file-name handlers specified via
(append opam-switch-common-environment process-environment))
(options (append args opam-switch-common-options)))
(when switch
- (push (format "--switch=%s" switch) options))
+ (push (format "--switch=%s" switch) options)
+ (push "--set-switch" options))
(when sexp
(push "--sexp" options))
;; (message "run %s %s %s" opam-switch-program-name sub-cmd options)
@@ -318,7 +319,7 @@ not any other shells outside Emacs."
opam-env)
(unless output-string
(error
- "Command 'opam env --switch=%s' failed - probably because of invalid
opam switch \"%s\""
+ "Command 'opam env --switch=%s --set-switch' failed - probably
because of invalid opam switch \"%s\""
switch-name switch-name))
(setq opam-env (car (read-from-string output-string)))
(unless opam-switch--saved-env