This Emacs library provides commands and a minor mode for easily reformatting dune files using dune's built-in format command.
If you choose not to use one of the convenient
packages in MELPA, you'll need to
add the directory containing dune-format.el
to your load-path
, and
then (require 'dune-format)
.
Call dune-format
, dune-format-buffer
or dune-format-region
as convenient.
Enable dune-format-on-save-mode
in dune-mode
buffers like this:
(add-hook 'dune-mode-hook 'dune-format-on-save-mode)
or locally to your project with a form in your .dir-locals.el like this:
((dune-mode
(mode . dune-format-on-save)))
You might like to bind dune-format
or dune-format-buffer
to a key,
e.g. with:
(define-key dune-mode-map (kbd "C-c C-f") 'dune-format)