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

do nothing when editor-config is activated #53

Open
sten0 opened this issue Jul 1, 2020 · 4 comments
Open

do nothing when editor-config is activated #53

sten0 opened this issue Jul 1, 2020 · 4 comments

Comments

@sten0
Copy link

sten0 commented Jul 1, 2020

I'm about half-way through the work of packaging dtrt-indent for Debian (we provide and support elpa-foo.deb packages as an alternative to MELPA), and I noticed that it seems to be missing the following logic: if editor-config is active, then do nothing. I'm not sure what the best method would be, but I think that if an upstream project provides an EditorConfig config file, then Do The Right Thing means silently doing nothing is editorconfig.el is installed (and allowing it to activate using its own mechanism), and otherwise not activating dtrt-indent but instead emitting a message to install https://github.com/editorconfig/editorconfig-emacs

Repository owner deleted a comment from sten0 Jul 3, 2020
@rrthomas
Copy link
Collaborator

rrthomas commented Jul 3, 2020

I agree that if editorconfig is active then dtrt-indent should defer to it, but otherwise, it should work as normal: if the user doesn't want to use editorconfig, then dtrt-indent should do its job, and also it's not really dtrt-indent's place to notify the user about editorconfig (they may neither know nor care about it).

@rrthomas
Copy link
Collaborator

rrthomas commented Jul 3, 2020

It's easy enough to detect whether editorconfig is installed and active, but how to detect whether there is a configuration for the current project? It seems to me that by dtrt-indent's philosophy, which is that it tries to guess the right thing to do, it should remain active if editorconfig is not run. It seems that editorconfig runs before the major mode hooks (it hooks into change-major-mode-after-body-hook, which runs before the major mode hooks (where dtrt-indent-mode is run), but editorconfig-apply doesn't seem to set anything to say that it has run. (I'm also not sure whether dtrt-indent should run when editorconfig-apply has run but unsuccessfully—probably not.)

@jscheid
Copy link
Owner

jscheid commented May 28, 2021

but editorconfig-apply doesn't seem to set anything to say that it has run

How about if dtrt-indent-mode simply ignore any settings that already have a buffer-local override? That should make it leave alone any relevant settings applied by editorconfig and also other packages, such as prettier. I suppose it would be a fairly major change at this point but I can't see how it would hurt.

@rrthomas
Copy link
Collaborator

@jscheid That seems reasonable.

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