[clug] Elastic tabstops

Robert Edwards bob at cs.anu.edu.au
Thu Oct 16 23:14:10 GMT 2008


David Tulloh wrote:
> Craig Small wrote:
>> On Fri, Oct 17, 2008 at 08:24:38AM +1100, Nathan Rickerby wrote:
>>   
>>> Who uses proportional fonts for coding?  Does the increase in readability
>>> that a proportional font gives you on large bodies of text also apply
>>> to code?
>>>     
>> I've never seen that, I would thought proportional font in programming
>> code would come out strange.
>>
>>  - Craig
>>   
> I'm not sure it would come out strange, but it would mean that you can't
> line up code on anything other than the start of the line.  I'm one of
> the people who likes his = and => columns to line up.
> 
> I can see fancy tabs working fairly well in a fancy editor, it sounds
> like how Microsoft Word implemented tabs.  If you just use the tab
> symbol in the ascii files it should be backwards compatible with all us
> normal tab users too.
> 
> 
> 
> David

I've never really understood this whole argument. Tabs and/or spaces are
used at the beginnings of lines of code to indicate indentation. For any
given line of code, the programmer(s) have in mind a particular level
of indentation. Tabs do this. 3 tabs => 3 levels of indentation. Period.

Doesn't matter if the person reading the code has their tabs set at 2,
4 or even 6.5 characters - the lines of code will always line up and
be indented at the level that the programmer(s) intended.

Spaces at the beginning of a line of code are what is causing all the
problems. Get rid of any editor that attempts to convert tabs to spaces
at the beginning of any line of code and all will be sweet. (I think
that includes emacs?...!).

Of course, if you like lining up the beginning of a line with some
arbitrary character in the line above (for whatever reason), then you
may need to use a combination of tabs (for indentation) followed by
spaces (for the alignment) - but that is something I seldom do* and
I don't think it makes the code much more readable...

Using a GUI to highlight, copy and then paste is also a problem... I
tend not to do this, or to be prepared to manually convert all the
spaces back to tabs after I have done it. Marking lines in the editor
and then pasting copies works fine for retaining the tabs.

Cheers,

Bob Edwards.

*except when writing kernel code...


More information about the linux mailing list