- Subject: Re: Looking for Python programmers for testing.
- From: "G. Milde" <g.milde@xxxxxx>
- Date: Tue, 12 Sep 2006 17:26:05 +0200
On 11.09.06, Jörg Sommer wrote:
> "G. Milde" <g.milde@xxxxxx> wrote:
> > On 7.09.06, Jörg Sommer wrote:
> The old version set TAB to zero if Py_Indent_Level != 8.
I hope we can agree, that this is a strange behaviour.
However, I see two problems with this setting:
1. It would set TAB = 0 even if Tabs are used in the buffer:
> If you open a file with tabs then, I see tons of ^I at the begin of
> line. That was my problem.
2. It uses the setting of Py_Indent_Level to determine if the user wants
tabs to indent python code.
> > The proposed patch continues to mix these two (to keep consistency?)
> No.
> >> + set_blocal_var(Py_Indent_Level == TAB, "py_use_tab");
>
> This is the default if no indented line is in the file, e.g. an empty
> file. Otherwise the type of indention in the file overwrites this setting.
However, this default still assumes there is info about the intended
use of Tabs or Spaces for indention in Py_Indent_Level.
> > My suggestion would be a separation of these two settings by
> > introducing a variable Py_Use_Tabs ...
> > The default would depend on the global variable USE_TABS, assuming
> > that if a user sets USE_TABS = 0 in his/her jed.rc, tabs should not
> > be used in pymode either.
>
> No, excacly this was my problem. I've set USE_TABS = 0 and opened a file
> with tabs. I've got a mixture of tabs and spaces; ugly.
I see. How about Py_Use_Tabs with the settings
-2 use Spaces, convert existing files
-1 auto-detect (biased to Spaces)
0 auto-detect (bias according to USE_TABS)
1 auto-detect (biased to Tabs)
2 use Tabs, convert existing files
> > The Tab-detecting in the proposed patch ...
> > favours Tabs in the case of an unconsistent file: one single Tab will
> > turn "py_use_tab" on.
>
> Sorry, but anywhere you must make a break. Don't try to be more
> intelligent then the user.
However, in the light of the strong preference of spaces in the
"Style Guide for Python Code" (http://www.python.org/dev/peps/pep-0008/)
I would prefer a bias towards Spaces. Others might disagree and this is
why I suggest Py_Use_Tabs. A configurable bias also solves the case of
new files.
> Inconsistent cases must be fixed by the user.
Agreed. It would be nice if the auto-detection issued a warning in case
of mixed tabs and spaces, though.
Providing a function that replaces Tabs in indented code lines
with Py_Indent_Level spaces might further facilitate this task.
> Mangling the variable TAB is not a good idea.
IMO, there is no problem, if combined with either auto-detection or
conversion. Even better: The ^I-s will show you where the automatism
failed (and IMO it is ok to have ^I-s in strings containing hard tabs).
Günter
--------------------------
To unsubscribe send email to <jed-users-request@xxxxxxxxxxx> with
the word "unsubscribe" in the message body.
Need help? Email <jed-users-owner@xxxxxxxxxxx>.
[2006 date index]
[2006 thread index]
[Thread Prev] [Thread Next]
[Date Prev] [Date Next]