Skip to content

Despite editorconfig-exclude-modes containing emacs-lisp-mode, settings from .editorconfig applied to init.el #376

@eaibmz

Description

@eaibmz

Hi,
i added emacs-lisp-mode to editorconfig-exclude-modes but settings from .editorconfig still have been applied to init.el.
The relevant .editorconfig is located in the parent folder of init.el.
I had to resort to editorconfig-after-apply-functionsand force my custom settings there.

Emacs: 30.2
editorconfig-emacs: f85ec97

Emacs config

(defun my/emacs-lisp-mode-setup()
  (bind-key "C-c C-k" 'eval-buffer)
  (setq indent-tabs-mode nil)
  (setq tab-width 2)
  (setq standard-indent 2)
  (setq lisp-indent-offset nil))

(add-hook 'emacs-lisp-mode-hook
          #'my/emacs-lisp-mode-setup())

(use-package editorconfig
  :config
  (dolist (mode '(emacs-lisp-mode lisp-mode))
    (map-delete editorconfig-indentation-alist mode))
  (setq editorconfig-lisp-use-default-indent t)
  (setq editorconfig-exclude-modes '(emacs-lisp-mode lisp-mode))
  (setq editorconfig-exclude-regexps
        (append editorconfig-exclude-regexps '("\\.org$" "\\.el$")))
  (add-hook 'editorconfig-after-apply-functions                                      ;; Only this helps !!!
            (lambda (props)
              (when (eq major-mode 'emacs-lisp-mode)
                (my/emacs-lisp-mode-setup))))
  (editorconfig-mode 1))

.editorconfig

[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
charset = utf-8
indent_style = tab
indent_size = 8

[*.sql]
indent_style = space
indent_size = 4

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions