[Pkg-geany-team] Bug#691693: Tabs in Python sourcefiles
Colomban Wendling
lists.ban at herbesfolles.org
Sun Oct 28 19:15:17 UTC 2012
Hi,
Le 28/10/2012 18:38, Ulrich Eckhardt a écrit :
> Package: geany
> Version: 1.22+dfsg-2
>
> With the default configuration, Geany uses tabs to indent Python sources.
> According to Python's coding guidelines (PEP 8), sources should not use any
> tabs but exactly four spaces. As a workaround, you can manually switch to
> spaces under "Document > Indent Type > Spaces", which already uses the correct
> width.
By default, Python files (like almost all other) use the indentation
type configured in the preferences, which indeed defaults to tabs.
However, Geany 0.21 added the possibility to set filetype-specific
indent settings, so you can very well set the Python default indentation
to 4 spaces (which, by the way, is the example in the Python filetype).
Check the documentation, but basically create a filetypes.python in
~/.config/geany/filedefs/ and set the width and type key under the
indentation section:
> [indentation]
> width=4
> # 0 is spaces, 1 is tabs, 2 is tab & spaces
> type=0
It isn't the default to follow user's configuration, because changing
overrides requires (for now?) to edit the filetypes files, and because
Python actually works with tabs (unlike Makefiles as you noted).
> Two notes:
> 1. I'm not sure if the Python template file is generated on the fly or loaded,
> but the template also uses tabs.
Yes, that's a know issue, currently the indentation in the templates
isn't converted to the user's indentation, and the default templates all
use tabs.
> 2. A similar issue might be Makefiles, which actually rely on being indented
> with tabs. I haven't tested those though.
Fortunately we already though about it and the Makefile filetype is
configured to use tabs-only by default :)
Regards,
Colomban
More information about the Pkg-geany-team
mailing list