4 ms·
> I really wish I could find something for Emacs which automatically detects the style of the code I'm editing and switches the coding style to that. If it mak
by larsberg 16y ago
> I really wish I could find something for Emacs which automatically detects the style of the code I'm editing and switches the coding style to that.
If it makes you feel any better, back when I was managing a team in Visual Studio, we called this the "When in Rome" feature. And yes, the versions of this we tried to put together worked as you'd expect... mostly. Determining peoples' whitespace decisions are not trivial. How many lines does the THEN clause of an IF need to have before you surround it with curlies? Do you only put a space before the parens around a function's arguments if there is more than one argument? And my personal favorite, how do you "funge" your indentation style if the nesting level gets high enough that you're at frequent risk of line wrap (soft or hard doesn't matter here)?
People have wacky rules, and as soon as you say you're going to auto-detect them, you're in for a world of pain. Of course, you might have a user base that isn't as persnickety, in which case it's really not that bad.
- leif 16y ago> How many lines does the THEN clause of an IF need to have before you surround it with curlies? If I'm your manager, 0.