mirror of
https://github.com/doomemacs/doomemacs
synced 2025-09-18 16:06:56 -05:00
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:
@@ -4,9 +4,9 @@
|
|||||||
#+since: 0.9
|
#+since: 0.9
|
||||||
|
|
||||||
* Description :unfold:
|
* Description :unfold:
|
||||||
This module integrates [[https://editorconfig.org/][EditorConfig]] into Emacs, allowing users to dictate code
|
This module adds [[https://editorconfig.org/][EditorConfig]] support to Emacs, allowing users to dictate code
|
||||||
style on a per-project basis with an =.editorconfig= file ([[https://editorconfig-specification.readthedocs.io/][formal
|
style on a per-project basis with =.editorconfig= files ([[https://editorconfig-specification.readthedocs.io/][formal specification]]),
|
||||||
specification]]).
|
with or without the native editorconfig binary.
|
||||||
|
|
||||||
** Maintainers
|
** Maintainers
|
||||||
- [[doom-user:][@hlissner]]
|
- [[doom-user:][@hlissner]]
|
||||||
@@ -33,12 +33,12 @@ specification]]).
|
|||||||
* Installation
|
* Installation
|
||||||
[[id:01cffea4-3329-45e2-a892-95a384ab2338][Enable this module in your ~doom!~ block.]]
|
[[id:01cffea4-3329-45e2-a892-95a384ab2338][Enable this module in your ~doom!~ block.]]
|
||||||
|
|
||||||
This module has one optional dependency: the ~editorconfig~ native binary.
|
This module has one optional dependency: the native ~editorconfig~ binary.
|
||||||
Without it, a built-in elisp implementation will be used, but it has fewer
|
Without it, a built-in elisp implementation will be used, which is claimed to be
|
||||||
features and can be a bit slower.
|
faster and more secure.
|
||||||
|
|
||||||
The editorconfig binary has [[https://github.com/editorconfig#contributing][many implementations]] you can choose from, typically
|
If you choose to install the binary, [[https://github.com/editorconfig#contributing][many implementations]] are available, usually
|
||||||
available through your OS package manager (or build it yourself).
|
through your OS package manager (if not built from source yourself).
|
||||||
|
|
||||||
* Usage
|
* Usage
|
||||||
You will need to write an ~.editorconfig~ file in your project (this is usually
|
You will need to write an ~.editorconfig~ file in your project (this is usually
|
||||||
|
@@ -6,6 +6,13 @@
|
|||||||
(use-package! editorconfig
|
(use-package! editorconfig
|
||||||
:hook (doom-first-buffer . editorconfig-mode)
|
:hook (doom-first-buffer . editorconfig-mode)
|
||||||
:config
|
: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)
|
(when (require 'ws-butler nil t)
|
||||||
(setq editorconfig-trim-whitespaces-mode 'ws-butler-mode))
|
(setq editorconfig-trim-whitespaces-mode 'ws-butler-mode))
|
||||||
|
|
||||||
|
@@ -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)"))
|
|
Reference in New Issue
Block a user