Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't override editorconfig locally #324

Open
richcarl opened this issue Feb 19, 2024 · 6 comments
Open

Can't override editorconfig locally #324

richcarl opened this issue Feb 19, 2024 · 6 comments
Assignees

Comments

@richcarl
Copy link

I'm on Emacs 29, and no matter what I do, it seems that editorconfig always overrides both dir-locals files and file local variables.

@jcs090218
Copy link
Contributor

See #148.

@richcarl
Copy link
Author

richcarl commented Mar 8, 2024

See #148.

Note: that issue is only about dir-locals, but editorconfig seems to always override even my file local variables.

@10sr 10sr self-assigned this May 14, 2024
@10sr
Copy link
Member

10sr commented May 31, 2024

Hi!

I updated the code and added two new variables editorconfig-override-file-local-variables and editorconfig-override-dir-local-variables, which are set to t by default. When editorconfig-override-dir-local-variables is set to nil, this plugin will not override values when it is defined in dir-locals.el .

I'm not going to set these variables to nil by default, because it is not likely that other editors support dir-locals.el files...

@richcarl
Copy link
Author

richcarl commented Jun 3, 2024

Thank you!

I still feel though that for Emacs, you expect that dir-locals and file-locals should be able to override any other configuration by default. The typical scenario is that a project has a .editorconfig file in its root (and perhaps additional ones per subdir), and then under one of the subdirs you may have some third party code or legacy code that follows its own rules, perhaps checked out as a dependency or git-subrepo, and that code may come with file-local annotations or a .dir-locals file. In that setting I expect Emacs to follow the most local rules for editing those files, not the project-wide rules. Maybe not everyone agrees.

@10sr
Copy link
Member

10sr commented Jun 7, 2024

We can add another .editorconfig file in the directory for that case.

Yeah, I know we can avoid creating new file explicitly if local variables override editorconfig values by default.
But, what I worry about is the case where users forget to add entries to .editorconfig file because they are already configured in .dir-locals.el .

@richcarl
Copy link
Author

If it's third party code, I'd have the choice of either asking them to add an .editorconfig file to their repo, which they may rightly think is irrelevant to them, or manually add a local .editorconfig file myself, which would then make git report a new untracked file (unless I also tell git to ignore it locally), and I'd have to remember to stop and do this just when I realize I want to edit a file in that subrepo. Philosophically, I don't think it's right for Emacs to ignore these. Maybe editorconfig could automatically offer to copy settings from .editorconfig to .dir-locals and/or vice versa, if both exist in the same dir and one of them is newer?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants