Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion modules/lang/coq/README.org
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,14 @@ This module adds [[https://coq.inria.fr][coq]] support, powered by [[https://pro
/This module has no dedicated maintainers./ [[doom-contrib-maintainer:][Become a maintainer?]]

** Module flags
/This module has no flags./
- +no-opam ::
Disable features depending on OPAM. As of now, it only disables ~opam-switch-mode~ integration.

** Packages
- [[doom-package:proof-general]]
- [[doom-package:company-coq]]
- [[doom-package:opam-switch-mode]] unless [[doom-module:+no-opam]]


** Hacks
+ Replaces coq-mode abbrevs with yasnippet snippets from doom's snippet library
Expand Down
15 changes: 15 additions & 0 deletions modules/lang/coq/config.el
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,18 @@
"e" #'company-coq-document-error
"E" #'company-coq-browse-error-messages
"h" #'company-coq-doc)))

(unless (modulep! +no-opam)
(use-package! opam-switch-mode
:hook (coq-mode . opam-switch-mode)
:preface
(map! :after coq
:localleader
:map coq-mode-map
"w" #'opam-switch-set-switch)
:init
(defadvice! +coq--init-opam-switch-mode-maybe-h (fn &rest args)
"Activate `opam-switch-mode' if the opam executable exists."
:around #'opam-switch-mode
(when (executable-find opam-switch-program-name)
(apply fn args)))))
6 changes: 6 additions & 0 deletions modules/lang/coq/doctor.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
;; -*- lexical-binding: t; no-byte-compile: t; -*-
;;; lang/coq/doctor.el

(unless (modulep! +no-opam)
(unless (executable-find "opam")
(warn! "Couldn't find OPAM")))
3 changes: 3 additions & 0 deletions modules/lang/coq/packages.el
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@

(package! proof-general :pin "3a99da275523c8f844fdfa3dd073295eece939f3")
(package! company-coq :pin "5affe7a96a25df9101f9e44bac8a828d8292c2fa")

(unless (modulep! +no-opam)
(package! opam-switch-mode :pin "1069e56a662f23ea09d4e05611bdedeb99257012"))
4 changes: 3 additions & 1 deletion modules/lang/ocaml/README.org
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,15 @@ This module adds [[https://ocaml.org/][OCaml]] support to Doom Emacs, powered by
- +tree-sitter ::
Leverages tree-sitter for better syntax highlighting and structural text
editing. Requires [[doom-module::tools tree-sitter]].
- +no-opam ::
Disable features depending on OPAM. As of now, it only disables ~opam-switch-mode~ integration.

** Packages
- [[doom-package:dune]]
- [[doom-package:ocamlformat]] if [[doom-module::editor format]]
- [[doom-package:ocp-indent]]
- [[doom-package:tuareg]]
- [[doom-package:opam-switch-mode]]
- [[doom-package:opam-switch-mode]] unless [[doom-module::+no-opam]]
- [[doom-package:utop]] if [[doom-module::tools eval]]
- unless [[doom-module:+lsp]]
- [[doom-package:flycheck-ocaml]] if [[doom-module::checkers syntax]]
Expand Down
38 changes: 19 additions & 19 deletions modules/lang/ocaml/config.el
Original file line number Diff line number Diff line change
Expand Up @@ -111,29 +111,29 @@
(remove-hook 'caml-mode-hook #'ocp-indent-caml-mode-setup))


(use-package! opam-switch-mode
:hook (tuareg-mode-local-vars . opam-switch-mode)
:preface
(map! :after tuareg
:localleader
:map tuareg-mode-map
"w" #'opam-switch-set-switch)
:init
(defadvice! +ocaml--init-opam-switch-mode-maybe-h (fn &rest args)
"Activate `opam-switch-mode' if the opam executable exists."
:around #'opam-switch-mode
(when (executable-find opam-switch-program-name)
(apply fn args)))
:config
;; Use opam to set environment
(setq tuareg-opam-insinuate t)
(opam-switch-set-switch (tuareg-opam-current-compiler)))

(unless (modulep! +no-opam)
(use-package! opam-switch-mode
:hook (tuareg-mode-local-vars . opam-switch-mode)
:preface
(map! :after tuareg
:localleader
:map tuareg-mode-map
"w" #'opam-switch-set-switch)
:init
(defadvice! +ocaml--init-opam-switch-mode-maybe-h (fn &rest args)
"Activate `opam-switch-mode' if the opam executable exists."
:around #'opam-switch-mode
(when (executable-find opam-switch-program-name)
(apply fn args)))
:config
(after! tuareg
;; Use opam to set environment
(setq tuareg-opam-insinuate t)
(opam-switch-set-switch (tuareg-opam-current-compiler)))))

(when (modulep! +tree-sitter)
(add-hook 'tuareg-mode-local-vars-hook #'tree-sitter!))


(use-package! dune
:defer t
:config
Expand Down
3 changes: 2 additions & 1 deletion modules/lang/ocaml/packages.el
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
;;; lang/ocaml/packages.el

(package! tuareg :pin "1d53723e39f22ab4ab76d31f2b188a2879305092")
(package! opam-switch-mode :pin "1069e56a662f23ea09d4e05611bdedeb99257012")
(unless (modulep! +no-opam)
(package! opam-switch-mode :pin "1069e56a662f23ea09d4e05611bdedeb99257012"))
(package! ocp-indent :pin "f38578c25d62701847b1bcb45099a9020e2032fe")
(package! dune
:recipe (:host github :repo "ocaml/dune" :files ("editor-integration/emacs/*.el"))
Expand Down