[TxMt] Re: Indent size different from tab size

James Milne james.milne at mac.com
Sat Oct 28 08:02:59 UTC 2006


On 28 Oct 2006, at 07:45, Jacob Rus wrote:
> James Milne wrote:
>> I am working a lot with source code written using Emacs on Linux.  
>> The prevailing convention is that tabs are presented as 8 spaces,  
>> but indents are only 4 spaces. Indenting will insert spaces, and  
>> Emacs seems to swap groups of 8 spaces for a tab.
>> If I use a tab size of 8 in Textmate, the source files display  
>> correctly. Sadly, there is no way to tell Textmate to use an  
>> indent size of 4.
>> It would be very useful is it was possible to tell TextMate to:
>> 1. Draw tabs as 8 spaces
>> 2. Use spaces when indenting
>> 3. Intend with 4 spaces, not the 8 spaces from a tab
>> Is there any way to do this with TextMate at the moment?
>
> No there isn't.  And this is a truly wacky convention from emacs?   
> Is that really the default in emacs?? I suggest that instead you  
> just make some simple commands for converting sane indentation <->  
> wacky emacs indentation, and then just run them when you open/save  
> documents. Sorry, but there really is no better way to do this at  
> the moment.
>
> Incidentally, is there any possible explanation for this behavior  
> in emacs?  Why use tab characters at all if the intention is to  
> have 4-space indents?  Just to save a few bytes of disk space??

Yes, it is a fairly standard behaviour. It probably goes back into  
the mists of time when people cared about saving a few bytes when  
working over a 1200 baud modem.

I'm not trying to justify it. It's not the way I would set up my  
source editing environment, but there you go.

Xcode is capable of differentiating between tabs and indents. If you  
go into the Indentation panel in Xcode Preferences, it specifies the  
width for a tab and the width for an indent, and allows you to  
specify whether the Tab key inserts a tab character or a set of spaces.

This is actually very common, and it is frustrating when TextMate is  
so good at pretty much everything else, but can't handle this  
relatively simple situation.

--
Kind regards,
James Milne



More information about the textmate mailing list