jcsalomon / smarttabs

Emacs smart tabs - indent with tabs, align with spaces!
http://www.emacswiki.org/emacs/SmartTabs
114 stars 20 forks source link

SmartTabs should not check tab-width matches prog-lang-indent-size #52

Open darkstego opened 2 years ago

darkstego commented 2 years ago

I have a problem with SmartTabs checking tab-width size matches every language's offset in order to work ((and smart-tabs-mode indent-tabs-mode (eq ,offset tab-width))

The biggest advantage of using smart tabs is that the indents can be variable, so every person can set the indentation to their preference and it will not interfere with anyone else working on the same code.

The language indent offset only makes sense when indenting with spaces, because with tabs it is always 1 tab per indent level. But with that last check that tab-width equals the offset you are stuck doing one of two things. Both of which are bad. Adjusting the tab width to match the language offset you lose the advantage of having tabs to choose your own indent level. And if you adjust the language offset to match tab-width, then every time you disable smarttabs you are inputting the incorrect number of spaces.

The only variable that should matter is indent-tabs-mode. That way you can have a per project settings (like editorconfig) and the only thing that matters is if the project indents with tabs or spaces. If tabs is specified then the project should be indented with tabs, regardless of whether your preferred tab-size matches the language's preferred offset.