Variable: editorconfig-mode
editorconfig-mode is a customizable variable defined in
editorconfig.el.gz.
Value
nil
Documentation
Non-nil if Editorconfig mode is enabled.
See the editorconfig-mode(var)/editorconfig-mode(fun) command
for a description of this minor mode.
Setting this variable directly does not take effect;
either customize it (see the info node (emacs)Easy Customization)
or call the function editorconfig-mode(var)/editorconfig-mode(fun).
Probably introduced at or before Emacs version 30.1.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/editorconfig.el.gz
;;;###autoload
(define-minor-mode editorconfig-mode
"Toggle EditorConfig feature."
:global t
(if (boundp 'hack-dir-local-get-variables-functions) ;Emacs≥30
(if editorconfig-mode
(progn
(add-hook 'hack-dir-local-get-variables-functions
;; Give them slightly lower precedence than settings from
;; `dir-locals.el'.
#'editorconfig--get-dir-local-variables t)
;; `auto-coding-functions' also exists in Emacs<30 but without
;; access to the file's name via `auto-coding-file-name'.
(add-hook 'auto-coding-functions
#'editorconfig--get-coding-system))
(remove-hook 'hack-dir-local-get-variables-functions
#'editorconfig--get-dir-local-variables)
(remove-hook 'auto-coding-functions
#'editorconfig--get-coding-system))
;; Emacs<30
(let ((modehooks '(prog-mode-hook
text-mode-hook
;; Some modes call `kill-all-local-variables' in their init
;; code, which clears some values set by editorconfig.
;; For those modes, editorconfig-apply need to be called
;; explicitly through their hooks.
rpm-spec-mode-hook)))
(if editorconfig-mode
(progn
(advice-add 'find-file-noselect :around #'editorconfig--advice-find-file-noselect)
(advice-add 'find-auto-coding :after-until
#'editorconfig--advice-find-auto-coding)
(dolist (hook modehooks)
(add-hook hook
#'editorconfig-major-mode-hook
t)))
(advice-remove 'find-file-noselect #'editorconfig--advice-find-file-noselect)
(advice-remove 'find-auto-coding
#'editorconfig--advice-find-auto-coding)
(dolist (hook modehooks)
(remove-hook hook #'editorconfig-major-mode-hook))))))