[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/opam-switch-mode eaf04b959d 25/31: fix: Improve error hand
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/opam-switch-mode eaf04b959d 25/31: fix: Improve error handling further (if opam can't be found) |
Date: |
Mon, 14 Nov 2022 09:00:01 -0500 (EST) |
branch: elpa/opam-switch-mode
commit eaf04b959dcb01aea32d6d76aebfec568c50b963
Author: Erik Martin-Dorel <erik.martin-dorel@irit.fr>
Commit: Erik Martin-Dorel <erik.martin-dorel@irit.fr>
fix: Improve error handling further (if opam can't be found)
---
opam-switch-mode.el | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/opam-switch-mode.el b/opam-switch-mode.el
index 871c3dfd56..1f8379c8f6 100644
--- a/opam-switch-mode.el
+++ b/opam-switch-mode.el
@@ -135,7 +135,8 @@ This function `opam-switch--run-command-without-stderr'."
(defun opam-switch--get-root ()
"Get the opam root directory.
-This is the opam variable 'root'."
+This function gets the opam variable 'root'.
+This function should not be called directly; see `opam-switch--root'."
(let ((root (opam-switch--command-as-string "var" nil nil "root")))
(unless root
(error "Command 'opam var root' failed"))
@@ -152,7 +153,7 @@ This is the opam variable 'root'."
(let ((result
(condition-case _sig
(opam-switch--get-root)
- (file-missing (message "Can't set (opam-switch--root); is opam
installed?") nil))))
+ (file-missing (error "Cannot run opam") nil))))
(when result
(setq opam-switch--root result)))))
@@ -352,9 +353,12 @@ The mode can be enabled only if opam is found and 'opam
var root' succeeds."
:keymap opam-switch--mode-keymap
:group 'opam-switch
(when opam-switch-mode
- (if (opam-switch--root)
- (opam-switch--setup-opam-switch-mode)
- (setq opam-switch-mode nil))))
+ (condition-case sig
+ (progn
+ (opam-switch--root)
+ (opam-switch--setup-opam-switch-mode))
+ (t (setq opam-switch-mode nil)
+ (message "Opam-Switch mode disabled %s" (pp-to-string sig))))))
(provide 'opam-switch-mode)
- [nongnu] elpa/opam-switch-mode f62c708225 14/31: typo fix, (continued)
- [nongnu] elpa/opam-switch-mode f62c708225 14/31: typo fix, ELPA Syncer, 2022/11/14
- [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 <=
- [nongnu] elpa/opam-switch-mode 9d8aa6d5dc 08/31: display current switch in menu, ELPA Syncer, 2022/11/14
- [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