Proof of concept that aims to simplify the Elisp code of ocamlformat.el by using the library reformatter.el.
(add-to-list 'load-path "path_to_ocamlreformat")
(add-to-list 'load-path "path_to_reformatter")
(require 'ocamlreformat)
;; format the buffer on save
(add-hook 'tuareg-mode-hook #'ocamlreformat-on-save-mode)
;; bind Ctrl-Meta-\ to format a valid region (by default, bound to `indent-region')
(define-key tuareg-mode-map (kbd "C-M-\\") 'ocamlreformat-region)
Use Makefile from the project root directory. Main targets:
make
- Download a copy of reformatter.el and compileocamlreformat.el
make test-*
- Start an new instance of Emacs with a minimal configurationmake clean
- Remove reformatter.el dependency and clean generated files.
- Support
ocamlformat-show-errors
- Package available from MELPA?
- Check it is a drop-in replacement of the current ocamlformat.el. So far, naming of the customizable variables is kept the same apart from the prefix (from
ocamlformat
toocamlreformat
).