Subject: Re: bug#70105: 30.0.50; Emacs should support EditorConfig out of the box

From: Rudolf Schlatte <[email-masked]>
Date: Wed, 19 Jun 2024 07:48:47 +0200

Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <[email-masked]> writes:

>> I'm still working on the actual metadata of that branch, as well as
>> etc/NEWS and doc, but in the mean time maybe you could look at the code to
>> see if you have any objections there.
>
> OK, I have a first cut at the doc done.
> So, here's what I'm proposing, presented as a single diff.
> Some commit messages still need to be improved (and I just noticed that
> the files' copyright lines also need to be fixed), but other than that,
> I think it's about ready.
>
> Comments?  Objections?
>
>
>         Stefan
>
> diff --git a/doc/emacs/custom.texi b/doc/emacs/custom.texi
> index 6bf4cbe00df..5287a90bb71 100644
> --- a/doc/emacs/custom.texi
> +++ b/doc/emacs/custom.texi
> @@ -1550,6 +1550,41 @@ Directory Variables
>  do not visit a file directly but perform work within a directory, such
>  as Dired buffers (@pxref{Dired}).
>  
> +@node EditorConfig support
> +@subsubsection Per-Directory Variables via EditorConfig
> +@cindex EditorConfig support
> +
> +The EditorConfig standard is an alternative to the @code{.dir-locals.el}
> +files, which can control only a very small number of variables, but
> +has the advantage of being editor-neutral.  Those settings are stored in
> +files named @code{.editorconfig}.
> +
> +If you want Emacs to obey those settings, you need to enable
> +the @code{editorconfig-mode} minor mode.  This is usually all that is
> +needed: when the mode is activated, Emacs will look for @code{.editorconfig}
> +files whenever a file is visited, just as it does for @code{.dir-locals.el}.
> +
> +When both @code{.editorconfig} and @code{.dir-locals.el} files are
> +encountered, the corresponding settings are combined, and in case there
> +is overlap, the settings coming from the nearest file take precedence.

What happens with both .dir-locals.el and .editorconfig present in the
current directory?  What would be the "nearest file" in that case?  (I'd
expect .dir-locals.el to override .editorconfig in that case, but there
are of course other possibilities.)