I'm working with an open-source Java project that uses the so-called "mixed" mode for indentation. This is the convention popularized by Emacs where indentations are (say) 4 spaces but tab characters expand to 8 spaces. Unfortunately, TextMate does not support this mode, as discussed previously [1]. There is a script that converts between mixed mode, but it appears to be manual [2], which won't work in my case. (I'd have to run the conversion every time I open and save a file.)
So, I need a better solution to get around TextMate's lack of support for mixed mode. I was thinking about submitting a patch upstream that would simply get rid of mixed mode and instead use Java's standard convention [3], but then I noticed that it apparently recommends mixed mode!
"Four spaces should be used as the unit of indentation. The exact construction of the indentation (spaces vs. tabs) is unspecified. Tabs must be set exactly every 8 spaces (not 4)."
Am I reading that right? Does Java's coding standard recommend mixed mode indentation? What are TextMate users to do in this situation?
Trevor
[1] http://comox.textdrive.com/pipermail/textmate/2004-December/ 002053.html [2] http://comox.textdrive.com/pipermail/textmate/2006-November/ 015565.html [3] http://java.sun.com/docs/codeconv/html/CodeConventions.doc3.html
Trevor Harmon wrote:
convention [3], but then I noticed that it apparently recommends mixed mode!
"Four spaces should be used as the unit of indentation. The exact construction of the indentation (spaces vs. tabs) is unspecified. Tabs must be set exactly every 8 spaces (not 4)."
Am I reading that right? Does Java's coding standard recommend mixed mode indentation? What are TextMate users to do in this situation?
This sounds to me like you should just use spaces for indentation, and leave out tabs. The point of the recommendation sounds like a way to make sure that if some use tabs, but everyone sets tabs to expand to 8 characters, people will still have the same 'view' of the source. But sticking to spaces should solve things while remaining within these guidelines.