I would like to couple elm-format-on-save-mode and elm-preview-main, so that when I save a file it gets formatted and compiled, and the generated html get's previewed.

(use-package elm-mode
  (elm-format-on-save-mode 1)
  (defun format-preview ()
    (require elm-format-on-save-mode)
    (require elm-preview-main)
    (when (eval-expression elm-format-on-save)
      (eval-expression elm-preview-main)))
  (add-hook 'elm-format-on-save-mode 'format-preview))

As it is, elm-format-on-save-mode is not activated automatically when I enter an .elm file. And it's not coupled to elm-preview. How can I fix these problems?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.