-
Notifications
You must be signed in to change notification settings - Fork 67
/
elm-format.el
63 lines (46 loc) · 1.94 KB
/
elm-format.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
;;; elm-format.el --- Automatically format an Elm buffer.
;; Copyright (C) 2015 Bogdan Popa
;; Author: Bogdan Popa
;; URL: https://github.com/jcollard/elm-mode
;; This file is not part of GNU Emacs.
;; This file is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.
;; This file is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;;; Code:
(require 'reformatter)
(defcustom elm-format-on-save nil
"When non-nil, run `elm-format-buffer' on save.
This variable is obsolete, and you should prefer to enable
`elm-format-on-save-mode' by adding it to your `elm-mode-hook',
or by placing a clause like the following in the .dir-locals.el
for your project:
((elm-mode (mode . elm-format-on-save)))"
:group 'elm-format
:type 'boolean)
(defcustom elm-format-elm-version "0.19"
"The version of Elm against which code should be formatted."
:group 'elm-format
:type 'string)
(defcustom elm-format-command "elm-format"
"The name of the `elm-format' command."
:group 'elm-format
:type 'string)
;;;###autoload (autoload 'elm-format-buffer "elm-format" nil t)
;;;###autoload (autoload 'elm-format-on-save-mode "elm-format" nil t)
(reformatter-define elm-format
:program elm-format-command
:args (list "--stdin" "--elm-version" elm-format-elm-version "--yes")
:group 'elm-format
:lighter " ElmFmt")
;;;###autoload
(define-obsolete-function-alias 'elm-mode-format-buffer 'elm-format-buffer "20190113")
(provide 'elm-format)
;;; elm-format.el ends here