Add :editorconfig setting
This commit is contained in:
parent
27cc4a9508
commit
105c0b945b
3 changed files with 17 additions and 5 deletions
|
@ -87,7 +87,21 @@
|
||||||
;; specify their own formatting rules.
|
;; specify their own formatting rules.
|
||||||
(def-package! editorconfig :demand t
|
(def-package! editorconfig :demand t
|
||||||
:mode ("\\.?editorconfig$" . editorconfig-conf-mode)
|
: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
|
;; Show whitespace in tabs indentation mode
|
||||||
(add-hook! 'editorconfig-custom-hooks
|
(add-hook! 'editorconfig-custom-hooks
|
||||||
(if indent-tabs-mode (whitespace-mode +1))))
|
(if indent-tabs-mode (whitespace-mode +1))))
|
||||||
|
|
|
@ -18,9 +18,7 @@
|
||||||
("add-hook" "remove-hook")))
|
("add-hook" "remove-hook")))
|
||||||
|
|
||||||
;; Don't affect lisp indentation (only `tab-width')
|
;; Don't affect lisp indentation (only `tab-width')
|
||||||
(setq editorconfig-indentation-alist
|
(set! :editorconfig :remove 'emacs-lisp-mode)
|
||||||
(delq (assq 'emacs-lisp-mode editorconfig-indentation-alist)
|
|
||||||
editorconfig-indentation-alist))
|
|
||||||
|
|
||||||
(defun +emacs-lisp|hook ()
|
(defun +emacs-lisp|hook ()
|
||||||
(setq mode-name "Elisp") ; [pedantry intensifies]
|
(setq mode-name "Elisp") ; [pedantry intensifies]
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
(def-package! moonscript
|
(def-package! moonscript
|
||||||
:mode ("\\.moon$" . moonscript-mode)
|
:mode ("\\.moon$" . moonscript-mode)
|
||||||
:config
|
:config
|
||||||
(push '(moonscript-mode moonscript-indent-offset) editorconfig-indentation-alist))
|
(set! :editorconfig :add '(moonscript-mode moonscript-indent-offset)))
|
||||||
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue