Author Topic: Override 'use tab' settings for some languages (Python and Makefiles)  (Read 7466 times)

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
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?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Override 'use tab' settings for some languages (Python and Makefiles)
« Reply #2 on: August 24, 2011, 12:34:24 pm »
Anyone against this patch? Any comments?

No.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Override 'use tab' settings for some languages (Python and Makefiles)
« Reply #3 on: August 24, 2011, 08:55:49 pm »
OK, In svn...
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Override 'use tab' settings for some languages (Python and Makefiles)
« Reply #4 on: August 25, 2011, 09:24:33 am »
OK, In svn...
Oh no! :lol: :lol: :lol:
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline hilborn

  • Single posting newcomer
  • *
  • Posts: 2
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 :( ).

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
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
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline hilborn

  • Single posting newcomer
  • *
  • Posts: 2
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 :)

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
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.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]