{"id":13803798,"url":"https://github.com/ProofGeneral/opam-switch-mode","last_synced_at":"2025-05-13T16:32:35.876Z","repository":{"id":142608831,"uuid":"497592196","full_name":"ProofGeneral/opam-switch-mode","owner":"ProofGeneral","description":"Select OCaml opam switches via a menu or using a command","archived":false,"fork":false,"pushed_at":"2023-08-02T09:17:29.000Z","size":94,"stargazers_count":6,"open_issues_count":1,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-12T05:31:18.651Z","etag":null,"topics":["emacs","merlin","ocaml","opam","proof-general","tuareg"],"latest_commit_sha":null,"homepage":"https://github.com/ProofGeneral/opam-switch-mode/blob/master/NEWS.md","language":"Emacs Lisp","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ProofGeneral.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2022-05-29T13:01:28.000Z","updated_at":"2025-01-22T20:25:24.000Z","dependencies_parsed_at":"2024-03-06T05:58:08.732Z","dependency_job_id":"651825c2-79bc-43df-a6be-8605ce0e2a81","html_url":"https://github.com/ProofGeneral/opam-switch-mode","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ProofGeneral%2Fopam-switch-mode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ProofGeneral%2Fopam-switch-mode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ProofGeneral%2Fopam-switch-mode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ProofGeneral%2Fopam-switch-mode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ProofGeneral","download_url":"https://codeload.github.com/ProofGeneral/opam-switch-mode/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253981948,"owners_count":21994363,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["emacs","merlin","ocaml","opam","proof-general","tuareg"],"created_at":"2024-08-04T01:00:37.990Z","updated_at":"2025-05-13T16:32:30.866Z","avatar_url":"https://github.com/ProofGeneral.png","language":"Emacs Lisp","funding_links":[],"categories":["Projects","Developer Tools"],"sub_categories":["User Interfaces"],"readme":"# opam-switch-mode\n\n[![NonGNU ELPA](https://elpa.nongnu.org/nongnu/opam-switch-mode.svg)](https://elpa.nongnu.org/nongnu/opam-switch-mode.html)\n[![MELPA Stable](https://stable.melpa.org/packages/opam-switch-mode-badge.svg)](https://stable.melpa.org/#/opam-switch-mode)\n[![MELPA](https://melpa.org/packages/opam-switch-mode-badge.svg)](https://melpa.org/#/opam-switch-mode)\n\nProvide a command `opam-switch-set-switch` to change the opam switch\nof the running Emacs session, and a minor mode `opam-switch-mode` to\nselect the opam switch via a (menu-bar or mode-bar) menu.\n\nThe menu is generated each time the minor mode is enabled and contains the\nswitches that are known at that time. If you create a new switch, re-enable\nthe minor mode to get it added to the menu. The menu contains an additional\nentry \"reset\" to reset the environment to the state when Emacs was started.\n\n## Installing `opam-switch-mode`\n\nWe recommend to install this mode from either the \n[NonGNU ELPA](https://elpa.nongnu.org/) or the\n[MELPA](https://melpa.org/) repository of Emacs packages.\nIn the sequel, we assume you have already set up those in your `.emacs`.\n\nIf you use the\n[`use-package`](https://github.com/jwiegley/use-package) macro, the\nrecommended configuration is as follows:\n\n    (use-package opam-switch-mode\n      :ensure t\n      :hook\n      ((coq-mode tuareg-mode) . opam-switch-mode))\n\nIf you don't use `use-package`, do the following instead:\n\n    (add-hook 'coq-mode-hook #'opam-switch-mode)\n    (add-hook 'tuareg-mode-hook #'opam-switch-mode)\n\nso that the minor mode is automatically enabled when `coq-mode` or `tuareg-mode` is on,\nsee also [`opam-switch-mode` aware modes](#opam-switch-mode-aware-modes).\n\n## Command `opam-switch-set-switch`\n\nInvoke with `M-x opam-switch-set-switch RET`.\n\nChoose and set an opam switch.\n\nSet opam switch SWITCH-NAME, which must be a valid opam switch name. When\ncalled interactively, the switch name must be entered in the minibuffer,\nwhich forces completion to a valid switch name or the empty string.\n\nSetting the opam switch for the first time inside Emacs will save the\ncurrent environment. Using the empty string for SWITCH-NAME will reset the\nenvironment to the saved values.\n\nThe switch is set such that all process invocations from Emacs respect the\nnewly set opam switch. In addition to setting environment variables such as\nPATH and CAML_LD_LIBRARY_PATH, this also sets `exec-path`, which controls\nEmacs' subprocesses (`call-process`, `make-process` and similar functions).\n\nJust before the switch is changed, `opam-switch-before-change-opam-switch-hook` runs.\nAfter the switch is changed, `opam-switch-change-opam-switch-hook` runs.\nOne of these can be used to inform other modes that run background processes\nthat depend on the currently active opam switch.\n\nFor obvious reasons, `opam-switch-set-switch` will only affect Emacs and not\nany other shells outside Emacs.\n\n## `opam-switch-mode` aware modes\n\n- `coq-mode` from [`proof-general`](https://proofgeneral.github.io/)\n  can kill the Coq background process when the opam switch changes,\n  see option [`coq-kill-coq-on-opam-switch`](https://proofgeneral.github.io/doc/master/userman/Coq-Proof-General/#index-coq_002dkill_002dcoq_002don_002dopam_002dswitch).\n- `tuareg-mode` from [`tuareg`](https://github.com/ocaml/tuareg)\n  can kill the OCaml background process when the opam switch changes,\n  see option `tuareg-kill-ocaml-on-opam-switch`.\n- `merlin-mode` from [`merlin`](https://github.com/ocaml/merlin)\n  can kill the underlying Merlin server when the opam switch changes,\n  see option `merlin-stop-server-on-opam-switch`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FProofGeneral%2Fopam-switch-mode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FProofGeneral%2Fopam-switch-mode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FProofGeneral%2Fopam-switch-mode/lists"}