feat(elm): add bindings for project compilation
Present in basically every other language module, these were mysteriously missing for Elm.
This commit is contained in:
parent
bb60f5f6bc
commit
b66ad77031
2 changed files with 37 additions and 2 deletions
29
modules/lang/elm/autoload.el
Normal file
29
modules/lang/elm/autoload.el
Normal file
|
@ -0,0 +1,29 @@
|
|||
;;; lang/elm/autoloads.el -*- lexical-binding: t; -*-
|
||||
|
||||
;;;###autoload
|
||||
(defun +elm/compile-html ()
|
||||
"Compile the current Elm project."
|
||||
(interactive)
|
||||
(let ((default-directory (doom-project-root)))
|
||||
(compile (format "elm make %s" buffer-file-name))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +elm/compile-html-optimized ()
|
||||
"Compile the current Elm project with optimizations."
|
||||
(interactive)
|
||||
(let ((default-directory (doom-project-root)))
|
||||
(compile (format "elm make %s --optimize" buffer-file-name))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +elm/compile-js ()
|
||||
"Compile the current Elm project to Javascript."
|
||||
(interactive)
|
||||
(let ((default-directory (doom-project-root)))
|
||||
(compile (format "elm make %s --output=main.js" buffer-file-name))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +elm/compile-js-optimized ()
|
||||
"Compile the current Elm project to Javascript with optimizations."
|
||||
(interactive)
|
||||
(let ((default-directory (doom-project-root)))
|
||||
(compile (format "elm make %s --output=main.js --optimize" buffer-file-name))))
|
|
@ -15,10 +15,16 @@
|
|||
:int "Int" :str "String"
|
||||
:float "Float"
|
||||
:bool "Bool"
|
||||
|
||||
:not "not"
|
||||
:and "&&" :or "||"))
|
||||
:and "&&" :or "||")
|
||||
|
||||
(map! :map elm-mode-map
|
||||
:localleader
|
||||
(:prefix ("m" . "elm make")
|
||||
:desc "Compile HTML" "m" #'+elm/compile-html
|
||||
:desc "Compile HTML (optimized)" "M" #'+elm/compile-html-optimized
|
||||
:desc "Compile JS" "j" #'+elm/compile-js
|
||||
:desc "Compile JS (optimized)" "J" #'+elm/compile-js-optimized)))
|
||||
|
||||
(use-package! flycheck-elm
|
||||
:when (modulep! :checkers syntax)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue