mirror of
https://github.com/jimeh/.emacs.d.git
synced 2026-02-19 13:46:41 +00:00
feat(language/caddyfile): format on save, use tab indentation
Caddy can now format Caddyfiles with the "caddy fmt" command, so we use reformatter to create a format-on-save mode for Caddyfiles. Also there's no need for the weird whitespace-mode workaround, as we now use tab indentation in Caddyfiles, since that's what "caddy fmt" produces.
This commit is contained in:
@@ -17,17 +17,14 @@
|
||||
|
||||
:preface
|
||||
(defun siren-caddyfile-mode-setup ()
|
||||
(setq-local tab-width 4
|
||||
indent-tabs-mode nil)
|
||||
(setq-local tab-width 4)
|
||||
(caddyfile-format-on-save-mode t))
|
||||
|
||||
;; TODO: Fix this horrible Hock. To work around prog-mode hooks running
|
||||
;; before current method, enabling whitespace-mode before the local
|
||||
;; indent-tabs-mode var is set to nil. Hence we need to toggle
|
||||
;; whitespace-mode off, and then on again to fix it's complaints about a
|
||||
;; space indentation.
|
||||
(when (bound-and-true-p whitespace-mode)
|
||||
(whitespace-mode -1)
|
||||
(whitespace-mode +1))))
|
||||
:config
|
||||
(reformatter-define caddyfile-format
|
||||
:program "caddy"
|
||||
:args '("fmt" "-")
|
||||
:lighter " fmt"))
|
||||
|
||||
(provide 'siren-caddyfile)
|
||||
;;; siren-caddyfile.el ends here
|
||||
|
||||
Reference in New Issue
Block a user