[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/opam-switch-mode 9d8aa6d5dc 08/31: display current switch
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/opam-switch-mode 9d8aa6d5dc 08/31: display current switch in menu |
Date: |
Mon, 14 Nov 2022 08:59:59 -0500 (EST) |
branch: elpa/opam-switch-mode
commit 9d8aa6d5dc858404d6d1c3984cd48f7b8e0937df
Author: Hendrik Tews <Hendrik.Tews@kernkonzept.com>
Commit: Hendrik Tews <Hendrik.Tews@kernkonzept.com>
display current switch in menu
---
opam-mode.el | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/opam-mode.el b/opam-mode.el
index 4c2364ec1d..72bc71513d 100644
--- a/opam-mode.el
+++ b/opam-mode.el
@@ -211,6 +211,13 @@ switch overwrote them."
(setq opam-saved-exec-path nil))
+(defun opam-get-current-switch ()
+ "Return name of current switch or \"<none>\"."
+ (let ((current-switch (getenv "OPAM_SWITCH_PREFIX")))
+ (if current-switch
+ (file-name-nondirectory current-switch)
+ "<none>")))
+
(defun opam-set-switch (switch-name)
"Chose and set an opam switch.
Set opam swith SWITCH-NAME, which must be a valid opam switch
@@ -234,10 +241,7 @@ not any other shells outside emacs."
(interactive
(let* ((switches (opam-get-switches))
(default (car switches))
- (current-switch (getenv "OPAM_SWITCH_PREFIX")))
- (if current-switch
- (setq current-switch (file-name-nondirectory current-switch))
- (setq current-switch "<none>"))
+ (current-switch (opam-get-current-switch)))
(list
(completing-read
(format "current switch %s; switch to (empty to reset): "
current-switch)
@@ -262,7 +266,12 @@ not any other shells outside emacs."
(defun opam-menu-items ()
"Create list or opam switches as menu items for `easy-menu'."
(nconc
- ;; first the list with all the real opam switches
+ ;; first the current switch as info
+ '(["current: " nil
+ :active t
+ :suffix (opam-get-current-switch)
+ :help "Shows the currently selected opam switch"])
+ ;; then the list with all the real opam switches
(mapcar
(lambda (switch)
(vconcat
- [nongnu] elpa/opam-switch-mode 95a3b4225a 15/31: fix: (opam-switch-mode) × 3 bug (#4), (continued)
- [nongnu] elpa/opam-switch-mode 95a3b4225a 15/31: fix: (opam-switch-mode) × 3 bug (#4), ELPA Syncer, 2022/11/14
- [nongnu] elpa/opam-switch-mode a306f75d82 31/31: docs(README.md): detail, ELPA Syncer, 2022/11/14
- [nongnu] elpa/opam-switch-mode 7306ce0fee 10/31: add separator in menu after current switch, ELPA Syncer, 2022/11/14
- [nongnu] elpa/opam-switch-mode e2ed274519 05/31: add emacs code documentation, also delete default switch parsing, ELPA Syncer, 2022/11/14
- [nongnu] elpa/opam-switch-mode 7de138a0e9 07/31: add minor mode with menu bar menu, ELPA Syncer, 2022/11/14
- [nongnu] elpa/opam-switch-mode e681cbdcb7 29/31: chore: Update header and maintainer mailing list, ELPA Syncer, 2022/11/14
- [nongnu] elpa/opam-switch-mode a83de84719 19/31: refactor: Replace `opsw--` with `opam-switch--`, ELPA Syncer, 2022/11/14
- [nongnu] elpa/opam-switch-mode 8a021ff128 12/31: rename to opam-switch-mode; use opsw as prefix for internals, ELPA Syncer, 2022/11/14
- [nongnu] elpa/opam-switch-mode df290bd0e3 21/31: Merge pull request #6 from ProofGeneral/prepare-melpa, ELPA Syncer, 2022/11/14
- [nongnu] elpa/opam-switch-mode eaf04b959d 25/31: fix: Improve error handling further (if opam can't be found), ELPA Syncer, 2022/11/14
- [nongnu] elpa/opam-switch-mode 9d8aa6d5dc 08/31: display current switch in menu,
ELPA Syncer <=
- [nongnu] elpa/opam-switch-mode 2c5ccd61f8 24/31: fix: Address review comments, ELPA Syncer, 2022/11/14
- [nongnu] elpa/opam-switch-mode d7ccecbf51 11/31: reset proof shell in Proof General via a hook function, ELPA Syncer, 2022/11/14
- [nongnu] elpa/opam-switch-mode 3a1c181d04 01/31: first version, can set but not reset, ELPA Syncer, 2022/11/14
- [nongnu] elpa/opam-switch-mode da49a0980b 03/31: license and minimal documentation, ELPA Syncer, 2022/11/14
- [nongnu] elpa/opam-switch-mode 0c2ecc2834 02/31: add reset, cleanup, ELPA Syncer, 2022/11/14
- [nongnu] elpa/opam-switch-mode 4f05665f5c 22/31: fix: Add missing autoloads, ELPA Syncer, 2022/11/14
- [nongnu] elpa/opam-switch-mode 4334933613 28/31: docs(README.md): Add MELPA badge, ELPA Syncer, 2022/11/14
- [nongnu] elpa/opam-switch-mode 7c2118fb9e 20/31: docs(README.md): Add direct hyperlink to PG online doc, ELPA Syncer, 2022/11/14
- [nongnu] elpa/opam-switch-mode c8ca450330 06/31: hint on other shells; update README, ELPA Syncer, 2022/11/14