[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Dir-Locals + Editorconfig Changes in Emacs 26

From: Jay Kamat
Subject: Dir-Locals + Editorconfig Changes in Emacs 26
Date: Mon, 02 Oct 2017 13:55:33 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.60 (gnu/linux)

Hi Everyone!

I use an emacs plugin called 'editorconfig' which provides an editor
independent way to set style configuration on a per-project basis, very
similar to the dir-locals feature in Emacs.

In emacs 25 and below, dir-locals and editorconfig interacted "as
expected", in that, the dir-locals file was applied after the
editorconfig, so dir-locals would take precedence over editorconfig

However, since emacs 26, this is reversed, where dir-locals is applied
first, rather than last, and so editorconfig overrides dir-locals. I
have filed a bug report to the project here to document it:

The reason that this is significant is that editorconfig not only lets
you configure on a per-project basis, but recursively on a per machine
basis as well, so if you have a editorconfig file in your home directory
(as many people do) those settings will apply for every file on your
system, overwriting dir-locals settings. Since dir-locals is more
powerful and project-specific, I would much prefer dir-locals to
override editorconfig.

Editorconfig seems to apply on the 'after-change-major-mode' hook, as
shown below:

I tried bisecting emacs to try to find a relevant change, but I wasn't
able to compile some of the older versions due to ASLR-related(?)
crashes I couldn't solve, so unfortunately that approach won't help me.

I am willing to help out with this, both on the editorconfig and the
emacs side of this to try and solve the issue, but I'm not sure where to
begin (since I'm very new to emacs development).

I'm essentially looking for one of:

1. A way to re-apply dir-locals settings manaully, so I can simply run 
that after editorconfig is done
2. A way to change dir-locals to apply after 'after-change-major-mode-hook'
3. A pointer to where dir-locals is applied in emacs source (since I
couldn't easily bisect it)
4. (undesirable) A way to check if dir-locals has been applied, so I can
turn of editorconfig in said situation.

I'll admit I could probably figure this out by going through the emacs
source code myself, but I thought it would be faster to try to find
someone who has seen this before, and I also wanted to ask for opinions
on this situation.

Thanks in advance,
-Jay Kamat

reply via email to

[Prev in Thread] Current Thread [Next in Thread]