doomemacs/modules/lang/ocaml
Henrik Lissner 037b018cdd
feat: add .doommodule files
These optional dotfiles indicate the root of a module or module
group (:lang), and will later contain module metadata. They will also
serve as an alternative to packages.el and doctor.el, and will aide the
parts of the v3.0 module API concerned with resolving the current module
from a path (`doom-module-from-path`), which currently rely too heavily
on parsing path strings.

For now, however, they're simply placeholders.
2024-09-14 20:47:39 -04:00
..
.doommodule feat: add .doommodule files 2024-09-14 20:47:39 -04:00
autoload.el Revert 3bb384f95 & improve ocaml comment continuation 2020-02-25 22:35:50 -05:00
config.el feat(ocaml): set formatter for dune-mode 2024-08-25 17:44:28 -04:00
doctor.el refactor: deprecate featurep! for modulep! 2022-08-14 20:43:35 +02:00
packages.el bump: :lang 2024-09-07 19:04:37 -04:00
README.org feat(ocaml): switch to using opam-switch-mode 2024-06-21 17:55:11 -04:00

:lang ocaml

Description   unfold

This module adds OCaml support to Doom Emacs, powered by doom-package:tuareg.

Maintainers

This module needs a maintainer. Become a maintainer?

Module flags

+lsp
Enable LSP support for tuareg-mode. Requires doom-module::tools lsp and a langserver (supports ocaml-language-server).
+tree-sitter
Leverages tree-sitter for better syntax highlighting and structural text editing. Requires doom-module::tools tree-sitter.

Hacks

  • set-ligatures! is called with the full tuareg prettify symbol list, this can cause columns to change as certain keywords are shortened (e.g. fun becomes λ).
  • opam-switch-set-switch is called the first time doom-package:tuareg and subsequently doom-package:opam-switch-mode are loaded

TODO Changelog

This module does not have a changelog yet.

Installation

Enable this module in your doom! block.

This module requires the following packages available through opam:

  • merlin
  • utop
  • ocp-indent
  • dune
  • ocamlformat

TODO Usage

󱌣 This module's usage documentation is incomplete. Complete it?

  • The following files should have syntax highlighting support: .ml{i,p,y,}, .eliom{i,}, jbuild, dune, opam
  • merlin-mode is activated whenever a .merlin file is found (including in a parent directory) and ocamlmerlin executable is present
  • Line-based auto-indentation is provided by ocp-indent, if it is available.
Command Key Description
merlin-type-enclosing <localleader> t display type under point
tuareg-find-alternate-file <localleader> a switch between .ml and .mli
merlin-locate g d lookup definition
merlin-occurences SPC c D lookup references
merlin-document K lookup documentation
merlin-imenu SPC s i symbol lookup in file
merlin-iedit-occurrences v R visual refactor identifier under point (multiple cursors)
utop SPC o r open utop as REPL
utop-eval-region SPC c e evaluate selected region in utop
opam-switch-set-switch <localleader> w evaluate selected region in utop

TODO Configuration

󱌣 This module's configuration documentation is incomplete. Complete it?

  • If doom-module::completion company is enabled then autocomplete is provided by doom-package:merlin
  • When doom-module::checkers syntax is enabled then doom-package:flycheck-ocaml is activated to do on-the-fly syntax/type checking via doom-package:merlin, otherwise this is only done when the file is saved.
  • Spell checking is activated in comments if doom-module::checkers spell is active
  • A REPL is provided if doom-package:utop is installed and doom-module::tools eval is active
  • If doom-module::editor format is enabled, the ocamlformat executable is available and there is an .ocamlformat file present then format-all-buffer is bound to ocamlformat, otherwise to ocp-indent
  • If doom-module::editor multiple-cursors is enabled then identifiers can be refactored with v R and multiple cursors (this correctly matches identifier occurrences according to scope, it is not purely a textual match)

Run $ doom sync to install all packages and $ doom doctor to diagnose missing tools.

Troubleshooting

There are no known problems with this module. Report one?

Frequently asked questions

This module has no FAQs yet. Ask one?

TODO Appendix

󱌣 This module has no appendix yet. Write one?