Add :editorconfig setting

This commit is contained in:
Henrik Lissner 2017-03-01 19:16:22 -05:00
parent 27cc4a9508
commit 105c0b945b
3 changed files with 17 additions and 5 deletions

View file

@ -87,7 +87,21 @@
;; specify their own formatting rules.
(def-package! editorconfig :demand t
:mode ("\\.?editorconfig$" . editorconfig-conf-mode)
:config (editorconfig-mode +1)
:init
(def-setting! :editorconfig (action value)
`(after! editorconfig
,(cond ((eq action :add)
`(push ',value editorconfig-indentation-alist))
((eq action :remove)
(unless (symbolp value)
(error "%s is not a valid major-mode in editorconfig-indentation-alist" value))
`(setq editorconfig-indentation-alist
(delq (assq ',value editorconfig-indentation-alist)
editorconfig-indentation-alist)))
(t (error "%s is an invalid action for :editorconfig" action)))))
:config
(editorconfig-mode +1)
;; Show whitespace in tabs indentation mode
(add-hook! 'editorconfig-custom-hooks
(if indent-tabs-mode (whitespace-mode +1))))

View file

@ -18,9 +18,7 @@
("add-hook" "remove-hook")))
;; Don't affect lisp indentation (only `tab-width')
(setq editorconfig-indentation-alist
(delq (assq 'emacs-lisp-mode editorconfig-indentation-alist)
editorconfig-indentation-alist))
(set! :editorconfig :remove 'emacs-lisp-mode)
(defun +emacs-lisp|hook ()
(setq mode-name "Elisp") ; [pedantry intensifies]

View file

@ -21,7 +21,7 @@
(def-package! moonscript
:mode ("\\.moon$" . moonscript-mode)
:config
(push '(moonscript-mode moonscript-indent-offset) editorconfig-indentation-alist))
(set! :editorconfig :add '(moonscript-mode moonscript-indent-offset)))
;;