Open correnson opened 8 years ago
+1, I am having a really bad time with .mll and .mly files
Indeed, syntax for .mll and .mly files is quite different.
.mll
, that can be enabled with --syntax=mll
(it indents rule _ = parse
better, but let _ = regexp+
for example needs additional parentheses or ocp-indent will consider +
as the binary operator it normally is). The emacs mode should automatically enable this on .mll
files but doesn't at the moment. You can do this manually for all ocaml files by customising ocp-indent-syntax
, or to temporarily do it just on the current buffer:M-: (setq-local ocp-indent-syntax '("mll"))
.mly
at the moment ; latest ocp-indent should not load when it detects that the file matches *.mly
, but tuareg doesn't do much better.In any case, you can locally disable ocp-indent while in tuareg-mode using
M-: (progn (kill-local-variable 'indent-line-function) (kill-local-variable 'indent-region-function) (tuareg--common-mode-setup))
Thanks for those tips!
It would be great to have ocp-indent automatically disabled from tuareg on mll
and mly
files until a better support for them. I'd share some workaround as soon as I have some.
It seems that
ocp-indent
works badly with parsing rules in.mll
files. However, it is automatically activated by the tuareg hook.