Emacs Mode and Tabs

Robin Munn rmunn at pobox.com
Fri Dec 20 12:19:09 EST 2002


Justin Shaw <wyojustin at hotmail.com> wrote:
> "Thomas Guettler" <pan-newsreader at thomas-guettler.de> wrote in message
> news:pan.2002.12.19.20.21.39.180460.730 at thomas-guettler.de...
>> Hi!
>>
>> I use xemacs with python-mode 4.1
>>
>> Unfortunately it does not automatically detect
>> if a file uses spaces or tabs for indentation.
>>
>> Is there a switch to make xemacs do the right
>> thing automatically?
>>
>>  thomas
> 
> Reindent all of your files with spaces then emacs will always do the right
> thing.
> Justin

[I rearranged the text so that the answer appears in the right place:
*below* the question. Please don't top-post, it's very annoying.]

A valiant (but probably doomed) attempt to head off the tabs-vs.-spaces
debate right now before it gets started:

Some people like to use tabs for indentation. Their argument is that
with tabs, you can change the tab spacing to your preferred size
(4-column indents, 8-column indents, or whatever), and so can the next
person, and you'll both see a nice-looking source file. Also, a tab
takes up only one character, while you need eight characters to get the
equivalent amount of indentation if you're using 8-column tab stops (the
standard setting on Unix).

Some people like to use spaces for indentation. Their argument is that
tabs should be avoided *precisely* because they give different views of
the same source file. Consistency within the file is more important than
having it look the way you prefer. And tabs would be fine if everyone
used them only for indentation, but that never happens. Inevitably,
someone will want to (say) split an if condition across two lines, and
their tab settings won't line up on the column they want. So they use
spaces to fill in the rest. Then when someone else (who uses different
tab settings) looks at the file, they see the if condition with wacky
indentation, and it looks ugly.

But no matter which side of the argument you hold, everybody agrees that
mixing tabs and spaces is A Very Bad Thing To Do.

There. Now that both sides of the argument have been treated in a fair
manner, can we skip the debate? Thanks.

-- 
Robin Munn <rmunn at pobox.com>
http://www.rmunn.com/
PGP key ID: 0x6AFB6838    50FF 2478 CFFB 081A 8338  54F7 845D ACFD 6AFB 6838



More information about the Python-list mailing list