[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/opam-switch-mode d7ccecbf51 11/31: reset proof shell in Pr
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/opam-switch-mode d7ccecbf51 11/31: reset proof shell in Proof General via a hook function |
Date: |
Mon, 14 Nov 2022 09:00:00 -0500 (EST) |
branch: elpa/opam-switch-mode
commit d7ccecbf512b480a5814a7801fd51470f23366e8
Author: Hendrik Tews <Hendrik.Tews@kernkonzept.com>
Commit: Hendrik Tews <Hendrik.Tews@kernkonzept.com>
reset proof shell in Proof General via a hook function
---
README.md | 9 +++++++++
opam-mode.el | 14 +++++++++++++-
2 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 590ecd24fd..c5fe341420 100644
--- a/README.md
+++ b/README.md
@@ -32,5 +32,14 @@ environment variables such as PATH and CAML_LD_LIBRARY_PATH,
this
also sets `exec-path`, which controls emacs' subprocesses
(`call-process`, `make-process` and similar functions).
+When the switch is changed, `opam-change-opam-switch-hook` runs. This
+can be used to inform other modes that may run background processes
+that depend on the currently active opam switch.
+
For obvious resons, `opam-set-switch` will only affect emacs and
not any other shells outside emacs.
+
+## Opam mode aware modes
+
+- Proof General can kill the coq background process, when the
+ opam switch changes, see `coq-kill-coq-on-opam-switch`.
diff --git a/opam-mode.el b/opam-mode.el
index 945062c413..967408f824 100644
--- a/opam-mode.el
+++ b/opam-mode.el
@@ -79,6 +79,13 @@ Otherwise parsing the output of opam commands won't work."
:group 'opam-mode
:type '(repeat string))
+(defcustom opam-change-opam-switch-hook nil
+ "Hook run when the opam switch changes.
+This is used, for instance, to let Proof General kill the coq
+background process when the opam switch changes."
+ :group 'opam-mode
+ :type '(repeat function))
+
;;; Code
@@ -245,6 +252,10 @@ also sets `exec-path', which controls emacs'
subprocesses (`call-process', `make-process' and similar
functions).
+When the switch is changed, `opam-change-opam-switch-hook' runs. This
+can be used to inform other modes that may run background processes
+that depend on the currently active opam switch.
+
For obvious resons, `opam-set-switch' will only affect emacs and
not any other shells outside emacs."
(interactive
@@ -268,7 +279,8 @@ not any other shells outside emacs."
(setq opam-env (car (read-from-string output-string)))
(unless opam-saved-env
(opam-save-current-env opam-env))
- (opam-set-env opam-env))))
+ (opam-set-env opam-env)))
+ (run-hooks 'opam-change-opam-switch-hook))
;;; minor mode, keymap and menu
- [nongnu] elpa/opam-switch-mode 7306ce0fee 10/31: add separator in menu after current switch, (continued)
- [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, 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 <=
- [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