[Geany-Users] Leading tabs vs. leading spaces by file extension.

Matthew Brush mbrush at xxxxx
Sun May 12 22:11:42 UTC 2019


On 2019-05-12 2:46 p.m., Douglas Morris via Users wrote:
> I would like the conversion of leading tabs to spaces for Python files and of leading spaces to tabs (but more importantly NOT vice versa) for Php files.  I am sure many of you have addressed this issue already and know how best to handle it in Geany. I don't see an obviously good way to handle it. I can only guess a special configuration file might do it, and call me lazy.
> 
> Python (*.py):
> The custom and better way in Python is leading spaces not leading tabs. If spaces and tabs are mixed, the visual appearance is not indicative of actual block nesting. Per PEP 8, Python 3 forbids mixing (unlike Python 2) and prefers spaces, 4 for each indent level: PEP 8 -- Style Guide for Python Code.
> 
> |
> |
> |
> |  |  |
> 
>   |
> 
>   |
> |
> |  |
> PEP 8 -- Style Guide for Python Code
> 
> The official home of the Python Programming Language
>   |
> 
>   |
> 
>   |
> 
> 
> 
> 
> Php (*.php):Wordpress recommends leading tabs: PHP Coding Standards | Wpcs Handbook Handbook | WordPress Developer Resources.
> 
> |
> |
> |  |
> PHP Coding Standards | Wpcs Handbook Handbook | WordPress Developer Reso...
> 
> 
>   |
> 
>   |
> 
>   |
> 
> 
> 
> I see this: Preferences -> Editor -> Indentation -> 'Detect type from file'. It is not working for me. I know, barely, that one can create a custom Geany configuration file. Can one specify the correct behavior by file extension, and is that a good or best way?
> I notice on the Geany Plugin Wishlist this item (stale as it is):
> 
> Feature found in Slickedit: Tabs to spaces option should be file extension dependent (i.e. you might want it most of the time but not e.g. for the .mak file extension). (Tuesday, September 29, 2009)
> 
> For anyone who already knows, what is the state of affairs on this desirable functionality? What good is the 'Detect type from file' setting? My experiments have been fruitless.
> 

Generally I use Geany "projects" feature which lets you set the 
indentation type for the whole project. If bringing in other files or 
copy/pasting with the wrong indentation, I use `Document->Replace Tabs 
with Spaces` (or vice versa) to correct the files.

Regards,
Matthew Brush



More information about the Users mailing list