Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => Topic started by: oBFusCATed on August 23, 2011, 11:25:32 pm

Title: Override 'use tab' settings for some languages (Python and Makefiles)
Post by: oBFusCATed on August 23, 2011, 11:25:32 pm
Hello,

I've done a little patch, which overrides the use tab setting per language.
I've changed the behaviour for two languages:
1. Python - always use spaces (mixing spaces and tabs breaks the file)
2. Makefiles - always use tabs (using spaces breaks the makefile!)

Here is the patch: http://smrt.is-a-geek.org/codeblocks/patches/override_usetabs_per_language.patch

Anyone against this patch? Any comments?
Title: Re: Override 'use tab' settings for some languages (Python and Makefiles)
Post by: MortenMacFly on August 24, 2011, 08:08:31 am
Anyone against this patch?
No.
Any comments?
No.
:-)
Title: Re: Override 'use tab' settings for some languages (Python and Makefiles)
Post by: Jenna on August 24, 2011, 12:34:24 pm
Anyone against this patch? Any comments?

No.
Title: Re: Override 'use tab' settings for some languages (Python and Makefiles)
Post by: oBFusCATed on August 24, 2011, 08:55:49 pm
OK, In svn...
Title: Re: Override 'use tab' settings for some languages (Python and Makefiles)
Post by: MortenMacFly on August 25, 2011, 09:24:33 am
OK, In svn...
Oh no! :lol: :lol: :lol:
Title: Re: Override 'use tab' settings for some languages (Python and Makefiles)
Post by: hilborn on May 27, 2012, 01:06:14 pm
Anyone against this patch? Any comments?
Yes.
I have recently been testing some nightly builds, to find out that Code::Blocks inserts spaces instead of a tab character, even though I've enabled the "Use TAB character" option.
This is counterintuitive and messes things up as I'm working with Python code were we are using tab characters (like you pointed out yourself, "mixing spaces and tabs breaks the file").
You might consider developing this feature further, by adding language-specific options or something in the Editor settings window.
I would really appreciate if this was not a hard-coded "invisible" feature (however the link to the patch seems broken, so I cannot see exactly what it's patching :( ).
Title: Re: Override 'use tab' settings for some languages (Python and Makefiles)
Post by: oBFusCATed on May 27, 2012, 02:01:19 pm
Here is the change: http://svn.berlios.de/wsvn/codeblocks/trunk/src/sdk/cbeditor.cpp?op=diff&rev=7411&peg=7411

But as far as I know, people are encouraged to use spaces, when programming in python.
http://www.python.org/dev/peps/pep-0008/#tabs-or-spaces
Title: Re: Override 'use tab' settings for some languages (Python and Makefiles)
Post by: hilborn on May 27, 2012, 04:38:41 pm
Here is the change: http://svn.berlios.de/wsvn/codeblocks/trunk/src/sdk/cbeditor.cpp?op=diff&rev=7411&peg=7411
Thanks!

But as far as I know, people are encouraged to use spaces, when programming in python.
http://www.python.org/dev/peps/pep-0008/#tabs-or-spaces
This is true. However it is also true that all code written in Python doesn't use spaces; the recommendation only applies for new projects. (And some people still prefer tabs over spaces.)
The single most important recommendation is to never mix tabs and spaces, so if the editor forces the user to spaces there will be problems in projects where tabs are used.
This seems like an opportunity for me to dive into the Code::Blocks source code :)
Title: Re: Override 'use tab' settings for some languages (Python and Makefiles)
Post by: oBFusCATed on May 27, 2012, 05:25:09 pm
I thought that pyople followed the pyctator rather passionately and without diverting from his commands! :)

However it is also true that all code written in Python doesn't use spaces...
What does it mean all here? All py-code I've seen is spaces only...

If you want to add an option the best place is in the Settings -> Editor-> General -> Other -> at the bottom.