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

Customization setting for modes which force a value for indent-tabs-mode? #144

Open
glasser opened this issue Oct 13, 2017 · 4 comments
Open

Comments

@glasser
Copy link
Contributor

glasser commented Oct 13, 2017

There are some file formats for which tabs are always illegal, such as YAML. yaml-mode knows this and always sets indent-tabs-mode to nil. But editorconfig overrides that.

Maybe that just means that every person everywhere who has [*] indent_style=tab needs to manually also add [*.{yaml,yml}] indent_style=space and this is an editorconfig issue, not an editorconfig-emacs issue. But maybe there could be a list of modes similar to editorconfig-indentation-alist that ignores indent_style rules? I dunno.

@10sr
Copy link
Member

10sr commented Oct 16, 2017

As for me having a value for this seems too much...
How about using editorconfig-custom-hooks?

(add-hook 'editorconfig-custom-hooks
          (lambda (hash)
            (when (eq major-mode 'yaml-mode)
              (setq indent-tabs-mode nil))))

@glasser
Copy link
Contributor Author

glasser commented Oct 16, 2017

I mean, there are multiple ways to fix this for myself, including the best way of fixing my project's editorconfig file, but this is a mode for which indent-tabs-mode is always incorrect (like, tabs are a syntax error in YAML). It would be nice if every editorconfig / YAML user didn't have to discover and fix this for themselves?

Arguably this just means that [*] indent_style=tab isn't a good idea in a project that might contain YAML though...

@glasser
Copy link
Contributor Author

glasser commented Oct 16, 2017

What if there was a variable that modes could set that says "seriously, no tabs, even if other packages want to set them" and editorconfig could look for that?

@10sr
Copy link
Member

10sr commented Nov 9, 2017

Umm... this is a difficult problem 🤔

As you may know editorconfig does not (and should not) know language specific things, and there seems to be no way to know if spaces are prefered for indent or not for modes (for example, yaml-mode setq indent-tabs-mode nil in its initialization, and that's all)...
For now I have no idea how to do about this.

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

2 participants