#16 Spaces - Tabs

closed
nobody
None
5
2004-12-31
2004-12-21
No

Hello Dan,

I was interested about the opinion of tabnanny,
and started a thread thereof in comp.lang.python
in the course of the discussion, this things
crystalled out, and I think, this would be a good
completition of the tabs-space stuff.
I simply post the message here:

===================================

"John Roth" <newsgroups@jhrothjr.com> wrote:
>> Do you think tabnanny is a useful piece of code now?
I used it a lot when
>> I first started using Python, and still run it over
code from unknown
>> sources (no pun intended) from time to time.
>
>I think it's a lot less useful today than it was a few
>years ago, but it's still useful if you're stuck with an
>editor that doesn't give you a robust set of options,
>or if you've got to check a lot of modules in a library.
>
>I think most python-aware editors have included
>the needed functionality, or at least some reasonable
>approximation.
>
>I know what I would like to see in an editor:
>
>First, it autodetects whether the module uses
>tabs consistently, spaces consistently or a
>mixture. If it uses tabs consistently, it then
>uses the current default.
>

>If it uses spaces consistently, it should also
>autodetect the indentation setting in use in
>the module and offer to change it if it's
>different from the current default indentation
>setting.
>
>If it's inconsistent, it should make an attempt
>to deduce the model the creating software
>used; if it can it should change it to the
>default setting without complaining. Otherwise
>it should complain.

I:
Again, DrPython does this almost as you described ;)
[...]
Edit=>Whitespace=>Check Indentation
Edit=>Whitespace=>Set Indentation to spaces
(replaces all tabs with the preset nr of spaces for tab

Exception 1:
(it could set then the tab mode to spaces)
and respectively:
Edit=>Whitespace=>Set Indentation to spaces
[...]
Exception 2:

If open a file, there could be a check, whether
tabs and spaces indentations are mixed, try to correct
if possible or complain (let the user decide).

=> Feature Request ;)

So my feature request is:
(I hope, I haven't overlooked anything)

1) after set indentation to spaces/tabs,
the indentation mode isn't changed.
It should change to the set indentation mode.

example: before, there were used spaces=>set
indentation mode to tabs=>then after pressing
tab, again spaces are inserted.
(As it is done in line endings, when you set line
endings from "WIN" to "UNIX", afer replaceing the new
default Line ending is also "UNIX".

2) there could be an option, as in line endings.

Check Indentation Format on Open.
(again, the first found indentation could be the new
indenation mode. If indentation is mixed, it should
silent (automatic) or after user inquiry (this could be
an option) set to the according mode, and set the
indentation type to this.

Cheers,

Discussion

  • Daniel Pozmanter

    Logged In: YES
    user_id=796750

    I got both. The first was a bug I have just fixed. The
    second is now an option, and it works exactly the same as
    line endings.

     
  • Daniel Pozmanter

    • status: open --> closed
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks