Indentation detection


I have a feeling that while I would consider this a bug, it may be considered a feature.

Here’s the situation: I have soft tabs set to off (as like to use real tabs for indentation). My tab width is the default of 2. If I load a file in that uses spaces (in my case 4 spaces, but that’s only a side issue) then Atom will detect this and “helpfully” convert the indentation to tabs for me.

I don’t really like this because I want to leave an opened file in the format it uses (I’d have though Atom could detect and put the editor in the right mode). And the side issue is that if the file uses any multiple of my tab size for its indentation (in this case 4), it replaces the four spaces (one tab’s worth in the file) with two tabs (two tabs’ worth in Atom terms). This is bad.

Any idea if this would be considered a bug, or if it’s a feature and I’d need to raise a feature request to add in a “detect indentation” mode? To me it seems like a bug only in that it can mess with something that works, and it’s hopefully generally agreed that indentation detection is good, but the effort to detect indentation is probably too much for a <1 release.

I’d like to hear people’s thoughts either way.


If the file in your example has no leading tabs, then I would definitely consider this a bug. It should stay in soft-tabs mode and preferably change to four spaces. The change to four spaces though would be a feature request, not a bug though.


Oh hold on, I think I was fooled by Atom’s cleverness. I think it correctly calculated that the file used spaces for indentation, didn’t know it was 4 over my default of 2, hence looking like double tabs. The really confusing thing was that Atom seemed to convert the spaces to tabs, and that was the source of my issue. However, I think I’ve realised that it didn’t do that (I didn’t think to show invisibles) but instead just treated each group of two spaces as a tab, thus meaning that pressing would advance me two spaces (i.e. one tabstop) instead of the norm of one space. How confusing!

I’ll check again tomorrow.