Thanks for giving it a try! Let me address your points:
1. Compilation mode regexp – Yes, neocaml installs the OCaml compilation regexp globally (replacing the ocaml entry in compilation-error-regexp-alist-alist), which is what you were asking about in a previous comment. It should only match OCaml-shaped error messages (File "...", line N, characters N-N:), so it shouldn’t interfere with other compilers. Could you share an example of the non-OCaml compilation output that’s getting matched incorrectly? That would help me tighten the regexp if needed.
2. Syntax highlighting customization – Absolutely. neocaml uses standard tree-sitter font-lock, so there are several levels of customization:
You can control how much gets highlighted via treesit-font-lock-level (1-4, default 3):
;; Minimal highlighting (only comments and definitions)
(setq treesit-font-lock-level 1)
;; Maximum highlighting (everything neocaml supports)
(setq treesit-font-lock-level 4)
You can also remap faces for specific syntactic constructs. For example, if you want type names to use a different face:
(custom-set-faces
'(font-lock-type-face ((t (:foreground "DarkSeaGreen4")))))
Or for more granular control, you can selectively enable/disable font-lock features with M-x treesit-font-lock-recompute-features. The available features are: comment, definition, keyword, string, number, attribute, builtin, constant, type, operator, bracket, delimiter, variable, function.
3. ocp-indent setup – Fair point, I should have included a snippet. Here’s what you need:
(defun my-neocaml-mode-setup ()
(setq-local indent-line-function #'ocp-indent-line)
(setq-local indent-region-function #'ocp-indent-region))
(add-hook 'neocaml-base-mode-hook #'my-neocaml-mode-setup)
I’ll add this to the README.