[Pkg-jed-devel] Bug#305668: jed mixes tabs and spaces in python mode

Vincent Bernat Vincent Bernat <bernat@luffy.cx>, 305668@bugs.debian.org
Thu, 21 Apr 2005 11:14:41 +0200


Package: jed
Version: 0.99.16-5
Severity: normal

When writing programs using python-mode, jed mixes tabs and spaces.
For example, type this script without ever using the tab key :

#! /usr/bin/env python

def test1(arg):
    # This line is indented using 4 spaces
    # This line too
    if 1 == 1:
        # However, this line is indented using one tab.
	pass

Using indent=4, tab=8 is the worse setup :

  <URL:http://groups.google.fr/groups?q=python+tab+space+guido&hl=fr&lr=&client=firefox-a&rls=org.mozilla:fr:official&selm=199804131539.LAA02742%40eric.CNRI.Reston.Va.US&rnum=1>

Here is what Guido recommends :

Indentation
Use the default of Emacs Python-mode: 4 spaces for one indentation
level. For really old code that you don't want to mess up, you can
continue to use 8-space tabs. Emacs Python-mode auto-detects the
prevailing indentation level used in a file and sets its indentation
parameters accordingly.

Tabs or Spaces?
Never mix tabs and spaces. The most popular way of indenting Python is
with spaces only. The second-most popular way is with tabs only. Code
indented with a mixture of tabs and spaces should be converted to using
spaces exclusively. (In Emacs, select the whole buffer and hit ESC-x
untabify.) When invoking the python command line interpreter with the -t
option, it issues warnings about code that illegally mixes tabs and
spaces. When using -tt these warnings become errors. These options are
highly recommended!

See :
  <URL:http://www.python.org/doc/essays/styleguide.html>

This bug is very annoying when opening the code with an editor (like
Emacs) that says that indent=4 and tab=4.

-- System Information:
Debian Release: 3.1
  APT prefers unstable
  APT policy: (990, 'unstable'), (500, 'testing')
Architecture: i386 (i686)
Kernel: Linux 2.6.10-1-k7
Locale: LANG=fr_FR@euro, LC_CTYPE=fr_FR@euro (charmap=ISO-8859-15)

Versions of packages jed depends on:
ii  jed-common                  0.99.16-5    byte compiled S-Lang runtime files
ii  libc6                       2.3.2.ds1-21 GNU C Library: Shared libraries an
ii  libgpmg1                    1.19.6-20    General Purpose Mouse - shared lib
ii  slang1                      1.4.9dbs-8   The S-Lang programming library - r

-- no debconf information