fix(editorconfig): default to native binary, if available

The default editorconfig implementation was changed upstream to the
elisp one, but — for the principle of least surprise — I believe it
should be the other way around: if the user has the native binary
installed, they're likely expecting it to be used; it will fall back to
the elisp implementation otherwise.

Also updates documentation to reflect these changes and removes the
doctor warning about a missing binary.

Ref: editorconfig/editorconfig-emacs#209
This commit is contained in:
Henrik Lissner
2025-09-18 00:21:01 -04:00
parent 09a80927f3
commit 64b085b381
3 changed files with 15 additions and 13 deletions

View File

@@ -4,9 +4,9 @@
#+since: 0.9
* Description :unfold:
This module integrates [[https://editorconfig.org/][EditorConfig]] into Emacs, allowing users to dictate code
style on a per-project basis with an =.editorconfig= file ([[https://editorconfig-specification.readthedocs.io/][formal
specification]]).
This module adds [[https://editorconfig.org/][EditorConfig]] support to Emacs, allowing users to dictate code
style on a per-project basis with =.editorconfig= files ([[https://editorconfig-specification.readthedocs.io/][formal specification]]),
with or without the native editorconfig binary.
** Maintainers
- [[doom-user:][@hlissner]]
@@ -33,12 +33,12 @@ specification]]).
* Installation
[[id:01cffea4-3329-45e2-a892-95a384ab2338][Enable this module in your ~doom!~ block.]]
This module has one optional dependency: the ~editorconfig~ native binary.
Without it, a built-in elisp implementation will be used, but it has fewer
features and can be a bit slower.
This module has one optional dependency: the native ~editorconfig~ binary.
Without it, a built-in elisp implementation will be used, which is claimed to be
faster and more secure.
The editorconfig binary has [[https://github.com/editorconfig#contributing][many implementations]] you can choose from, typically
available through your OS package manager (or build it yourself).
If you choose to install the binary, [[https://github.com/editorconfig#contributing][many implementations]] are available, usually
through your OS package manager (if not built from source yourself).
* Usage
You will need to write an ~.editorconfig~ file in your project (this is usually

View File

@@ -6,6 +6,13 @@
(use-package! editorconfig
:hook (doom-first-buffer . editorconfig-mode)
:config
;; The elisp implementation is the default (rather than the external,
;; editorconfig binary), because upstream claims it's "faster and more
;; secure". Whether that's true or not, I argue the principle of least
;; surprise: if the user has the editorconfig binary installed, they're likely
;; expecting it to be used.
(setq editorconfig-get-properties-function #'editorconfig-get-properties)
(when (require 'ws-butler nil t)
(setq editorconfig-trim-whitespaces-mode 'ws-butler-mode))

View File

@@ -1,5 +0,0 @@
;; -*- lexical-binding: t; no-byte-compile: t; -*-
;;; tools/editorconfig/doctor.el
(unless (executable-find "editorconfig")
(warn! "Couldn't find the editorconfig binary. Using native elisp version (slower)"))