I'm working through the Real World OCaml book. Based on the installation instructions, I installed
tuareg-mode for editing OCaml code.
It is version 2.0.9, which appears to be the latest version.
The corresponding code in my init.el looks like:
(add-hook 'tuareg-mode-hook 'tuareg-imenu-set-imenu) (setq auto-mode-alist (append '(("\\.ml[ily]?$" . tuareg-mode) ("\\.topml$" . tuareg-mode)) auto-mode-alist)) (autoload 'utop-setup-ocaml-buffer "utop" "Toplevel for OCaml" t) (add-hook 'tuareg-mode-hook 'utop-setup-ocaml-buffer) (add-hook 'tuareg-mode-hook 'merlin-mode) (setq merlin-use-auto-complete-mode t) (setq merlin-error-after-save nil)
When I try to type code into a .ml file, it indents things weirdly. For example, if I type
open Core.Std (* it indents like this *) (* for every line in the rest of the file *) (* But I would expect it to indent like this *)
When I type a
let statement, it does move to the left, but only after I press return to move on to the next line.
Inside a function definition, indentation works as expected, but the top level of the file indents like the example above. How can I make the top-level indentation behave?