diff --git a/core/core-editor.el b/core/core-editor.el index 1551c3042..faca0482e 100644 --- a/core/core-editor.el +++ b/core/core-editor.el @@ -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)))) diff --git a/modules/lang/emacs-lisp/config.el b/modules/lang/emacs-lisp/config.el index 0f213829d..6042f4145 100644 --- a/modules/lang/emacs-lisp/config.el +++ b/modules/lang/emacs-lisp/config.el @@ -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] diff --git a/modules/lang/lua/config.el b/modules/lang/lua/config.el index ab14d83b8..fb0eb7cb7 100644 --- a/modules/lang/lua/config.el +++ b/modules/lang/lua/config.el @@ -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))) ;;