TAB settings in python.properties

1,162 views
Skip to first unread message

romor

unread,
Aug 8, 2010, 8:10:08 PM8/8/10
to scite-i...@googlegroups.com
When editing python files in SciTE, indentation is ruined. I don't understand why is that. Shouldn't python.properties file distributed with SciTE have this lines:

use.tabs=0
indent.size=4

by default?

Neil Hodgson

unread,
Aug 9, 2010, 8:14:51 AM8/9/10
to scite-i...@googlegroups.com
romor:

The standard behaviour of most editors is to use 8 space tabs and
to insert tab characters when the tab key is used. If you prefer
something else then set the properties to match your preferences. If
you want the indentation settings to match existing indentation when
opening a file you could use indent.auto.

Neil

romor

unread,
Aug 9, 2010, 8:44:18 AM8/9/10
to Neil Hodgson
> If you want the indentation settings to match existing indentation when opening a file you could use indent.auto.

That's even better :)

The thing is that I've never seen python code with tab indentation (nor it is recommended as a python style) and when changing something in the code (for example just hitting Enter) SciTE uses tab by default and code is ruined. Ruining strict python indentation is just so often when inexperienced users copy/paste code with almost any editors, as I've noticed, but that more general issue

indent.auto option seems like good idea to me for default python. properties file

Neil Hodgson

unread,
Aug 10, 2010, 10:00:16 AM8/10/10
to scite-i...@googlegroups.com
romor:

> indent.auto option seems like good idea to me for default python. properties file

Its a global option so does not belong in python.properties.

It is also a bit dangerous as it overrides explicit settings for
using tabs and tab size. I'm sure if a new version of SciTE was
released with indent.auto=1 then there would be many bug reports:
"SciTE is ignoring my tab.size setting".

Neil

romor

unread,
Aug 10, 2010, 11:56:52 AM8/10/10
to Neil Hodgson
I just put indent.auto in python.properties, and with python scripts it works very nice. Ctrl+Shift+I > Use tabs, also works fine: tab is used as set in that dialog.

Why are you suggesting indent.auto to be used globally?

I use PyDev for python scripting, but in many occasions it's much nicer to just launch SciTE and change and test things than whole Eclipse. I've made my changes in python.properties so no issue to me: When updating SciTE I just replace two main program files without properties, but I wanted to address this issue so that others won't experience this: http://i37.tinypic.com/oix6o2.png

Are there python scripters that does this differently?

steve donovan

unread,
Aug 10, 2010, 12:12:17 PM8/10/10
to scite-i...@googlegroups.com
On Tue, Aug 10, 2010 at 5:56 PM, romor <deja...@gmail.com> wrote:
> Are there python scripters that does this differently?

http://www.artima.com/weblogs/viewpost.jsp?thread=143947

Guido himself on his tab policy:

"Fortunately it's easy to separate the two. If it uses two-space
indents, it's corporate code; if it uses four-space indents, it's open
source. (If it uses tabs, I didn't write it! :-)"

Tab use is something like a religious issue. Which is why SciTE
shouldn't interfere with other people's tab settings ;)

steve d.

romor

unread,
Aug 10, 2010, 12:34:49 PM8/10/10
to scite-i...@googlegroups.com
I just can't see single reason why indent.auto shouldn't be used in python.properties.

- If I start to write new python code, tabs are set as default set in SciTE (no one can complain)
- If I edit existing code, indentation is preserved: with or without tab, and that's automagically

Am I overseeing something?

Neil Hodgson

unread,
Aug 10, 2010, 7:31:01 PM8/10/10
to scite-i...@googlegroups.com
romor:

> Why are you suggesting indent.auto to be used globally?

I am not. I am saying that indent.auto *is* a global property. If
you set it in python.properties, it will also affect C++ and HTML and
Ada...

The language properties files are not active only when that
language is in use. All the language properties files are active all
the time.

Neil

romor

unread,
Aug 10, 2010, 8:21:02 PM8/10/10
to Neil Hodgson
I don't know where is this topic going, but I think I suggested reasonable request

> If you set it in python.properties, it will also affect C++ and HTML and Ada...

That is not happening here, nor I see that logic. As I said I put indent.auto in python.properties - opening HTML or CPP/C file and editing it doesn't preserve indentation present in file. HTML uses spaces and CPP/C uses tabs regardless settings in my python.properties

romor

unread,
Aug 10, 2010, 8:27:26 PM8/10/10
to scite-i...@googlegroups.com
+ indent.auto is commented in my global.properties

Neil Hodgson

unread,
Aug 10, 2010, 11:06:32 PM8/10/10
to scite-i...@googlegroups.com
romor:

> I don't know where is this topic going, but I think I suggested reasonable
> request

Your request is unworkable as explained.

>> If you set it in python.properties, it will also affect C++ and HTML
>> and Ada...
>
> That is not happening here, nor I see that logic.

I don't know why you are not seeing this but I have explained how it works.

> + indent.auto is commented in my global.properties

The "import python" statement includes python.properties into
global properties and you set indent.auto in python.properties so the
effect is as if indent.auto was set in global properties.

Neil

romor

unread,
Aug 10, 2010, 11:35:56 PM8/10/10
to Neil Hodgson
I see now that works in a way you said: When I first tried, I opened file, then converted tabs to spaces to see if auto indent will work, but file needs to be saved AND reopened so that auto indent would work

OK, I tried to save some beginner python souls :)
As if somebody is new to SciTE, I guess setting indenting options in properties text file would not be his/her first step

John Yeung

unread,
Aug 11, 2010, 2:33:24 AM8/11/10
to scite-i...@googlegroups.com
On Tue, Aug 10, 2010 at 11:35 PM, romor <deja...@gmail.com> wrote:
> OK, I tried to save some beginner python souls :)

It's a nice thought, but I think tabs vs. spaces is not a big problem
in SciTE because it is quite easy to fix. What I don't like about
SciTE for Python is that it doesn't really handle autoindentation. It
only gives you two choices: (1) Look for colons, and mistakenly
indent when you are just using slices; or (2) look for keywords, and
mistakenly indent when you are using list comprehensions or generator
expressions.

The only way, as far as I know, to provide correct Python
autoindentation is to patch the source, which I haven't done since
1.76 (so that is the version I am still using).

> As if somebody is new to SciTE, I guess setting indenting
> options in properties text file would not be his/her first step

Perhaps not their first step, but much easier than rebuilding SciTE from source.

John

Reply all
Reply to author
Forward
0 new messages