Best IDE?

S

Stevie_mac

Thanks for the heads up


SM said:
Hi,
Just to let you all know that there is a new version of SPE being
developped with a much faster class/index/todo browser (can be even
realtime!), wxPython 2.5 support, simultaneous view of source code,
you can choose between MDI or SDI both with tabs, better control of
calltips (only first paragraph or all doc) ... If you are curious,
you can download it from http://projects.blender.org/projects/spe/ The
windows XP version is already quite stable, for linux and mac os x,
I'm dependent of other users.
Stani
 
J

JZ

1 May 2004 15:06:21 -0700, na comp.lang.python, SM napisa³(a):
you can download it from http://projects.blender.org/projects/spe/ The
windows XP version is already quite stable, for linux and mac os x,
I'm dependent of other users.

SPE is still buggy for Windows XP. If you use non-ascii characters it can
delete all content of the file. Yesterday I lost one file usign new SPE
editor and I come back to PythonWin. The same bug was in earlier version.
 
B

Brian Quinlan

Right now I'm working in an environment where tabs were mandated as the
indentation style for Python. I've managed to persuade everyone to
switch to 4 space indentation.

The problem is that we now have a migration problem. Most of our
develoeprs are using VIM which, AFAIK, is not intelligent enough to
detect the current indentation style of a file. Modifying all of our
source files at once to use spaces and then getting everyone to change
their .vimrc is a posibility but not desirable because everyone would
have to check in their work (whatever it's state) at the time of
migration. Does anyone have any suggestions? Ideally, there would be
some way to tell VIM to use the file's exsiting indentation style. That
way I could slowly switch to spaces over time.

Cheers,
Brian
 
C

Christophe Cavalaria

Brian said:
The problem is that we now have a migration problem. Most of our
develoeprs are using VIM which, AFAIK, is not intelligent enough to
detect the current indentation style of a file. Modifying all of our
source files at once to use spaces and then getting everyone to change
their .vimrc is a posibility but not desirable because everyone would
have to check in their work (whatever it's state) at the time of
migration. Does anyone have any suggestions? Ideally, there would be
some way to tell VIM to use the file's exsiting indentation style. That
way I could slowly switch to spaces over time.

Cheers,
Brian

Try adding that line at the end of each modified file :

# vim:sw=4:softtabstop=4:expandtab

It tells vim all the commands it should automatically run when it opens the
file and it should get you the correct behaviour for 4 spaces no tab
indentation.
 
N

Neal D. Becker

SM said:
Hi,
Just to let you all know that there is a new version of SPE being
developped with a much faster class/index/todo browser (can be even
realtime!), wxPython 2.5 support, simultaneous view of source code,
you can choose between MDI or SDI both with tabs, better control of
calltips (only first paragraph or all doc) ... If you are curious,
you can download it from http://projects.blender.org/projects/spe/ The
windows XP version is already quite stable, for linux and mac os x,
I'm dependent of other users.
Stani

Does SPE feature running python subprocess? Python debug? Jump to error?
 
B

Brian Quinlan

Christophe said:
Try adding that line at the end of each modified file :

# vim:sw=4:softtabstop=4:expandtab

It tells vim all the commands it should automatically run when it opens the
file and it should get you the correct behaviour for 4 spaces no tab
indentation.

Thanks for the suggestion but modifying all my files is a pretty ugly
solution. Not that I'm above using it if there is no better way :)

Cheers,
Brian
 
A

Alejandro =?iso-8859-1?Q?L=F3pez-Valencia?=

Thanks for the suggestion but modifying all my files is a pretty ugly
solution. Not that I'm above using it if there is no better way :)

The better way is to read the fine manual (not that many do, it is too
big :).

$ mkdir -p .vim/ftplugin
$ cd .vim/ftplugin
$ vim python_pep8.vim
....

dradul@shangri-la ~/.vim/ftplugin
[238]-% cat python_pep8.vim
if exists("did_python_pep8")
finish
else
let did_python_pep8=1
endif
set tabstop=4
set shiftwidth=4
set softtabstop=4
set expandtab
set textwidth=80

And that's all there it to it.

--
Alejandro López-Valencia
qenqhy ng rgo qbg arg qbg pb
http://dradul.tripod.com/
The limits of my language are the limits of my world.
(L. Wittgenstein)
 
A

Alejandro =?iso-8859-1?Q?L=F3pez-Valencia?=

I use these settings myself, but just now after posting, I realized that
it is far better to set the preferences on a per-buffer basis, so I
change my advice to the following:

$ mkdir -p .vim/ftplugin
$ cd .vim/ftplugin
$ vim python_pep8.vim
....

$ cat python_pep8.vim
if exists("b:did_python_pep8")
finish
else
let b:did_python_pep8=1
endif
set tabstop=4
set shiftwidth=4
set softtabstop=4
set expandtab
set textwidth=80

This way, you can open a python file and a file with a different syntax
on two buffers of the same vim session.

And this is *really* all there is to it.

Cheers

--
Alejandro López-Valencia
qenqhy ng rgo qbg arg qbg pb
http://dradul.tripod.com/
The limits of my language are the limits of my world.
(L. Wittgenstein)
 
E

Eli Stevens \(WG.c\)

Brian Quinlan said:
Thanks for the suggestion but modifying all my files is a pretty ugly
solution. Not that I'm above using it if there is no better way :)

Is it safe to assume you are working in a *nix environment? If so, shell
scripts can be your friend (I use bash below). The <ctrl-V><ctrl-I> below
is a literal tab character (bash specific, I think). Note that this will
convert all tabs, not just those leading the line.

# Untested...
for file in `find . -type f -name "*.py"`
do
cat $file | sed -e "s/<ctrl-V><ctrl-I>/ /g" > /tmp/tmp.py
mv /tmp/tmp.py $file
done

Heck, if you wanted, you could even have the script add the vim: line for
you. Of course, that would mean that running the below twice would start
adding duped, junk lines.

# Untested...
for file in `find . -type f -name "*.py"`
do
cat $file | sed -e "s/<ctrl-V><ctrl-I>/ /g" > /tmp/tmp.py
echo "# vim:sw=4:softtabstop=4:expandtab" >> /tmp/tmp.py
mv /tmp/tmp.py $file
done

Managing the changeover so that multiple developers stay in synch without
creating merge conflicts is left as an exercise for the reader and his/her
version control software. ;)

In a vain attempt to bring this back on-topic, how would people accomplish
the same in Python? I can't imagine that it would be that hard, but I'm a
relative newbie. :)

Eli

--
Give a man some mud, and he plays for a day.
Teach a man to mud, and he plays for a lifetime.
WickedGrey.com uses SpamBayes on incoming email:
http://spambayes.sourceforge.net/
--
 
B

Brian Quinlan

I use these settings myself, but just now after posting, I realized that
it is far better to set the preferences on a per-buffer basis, so I
change my advice to the following:
[snipped]

And this is *really* all there is to it.

I don't know what this is supposed to do, but it doesn't seem to do what
I want. Here is the test I performed:

1. create a new file using tab indentation
2. open it in VIM
3. hit the tab key

VIM inserts 4 spaces for the tab so I now have a file containing mixed
tabs and spaces. Ideally, I would like VIM to be smart enough (like
every other programmer's editor in the universe) to detect the current
tab settings in the file and use those.

Cheers,
Brian
 
A

Alejandro =?iso-8859-1?Q?L=F3pez-Valencia?=

I use these settings myself, but just now after posting, I realized that
it is far better to set the preferences on a per-buffer basis, so I
change my advice to the following:
[snipped]

And this is *really* all there is to it.

I don't know what this is supposed to do, but it doesn't seem to do what
I want. Here is the test I performed:

1. create a new file using tab indentation
2. open it in VIM
3. hit the tab key

VIM inserts 4 spaces for the tab so I now have a file containing mixed
tabs and spaces.

If you are starting with a file that already contains tabs *and* spaces,
I'd say you have already called upon you the gods of disaster. Python
source code files should use *either* tabs or spaces and the recommended
length for a tab is the equivalent of 4 spaces. Unfortunately most
editors can't be told the size of a hardware tab and assume it is 8
spaces always or if having some built-in smarts read the definition from
the current terminal terminfo/termcap driver and that is a fixed value.
Unless you use 8-space tabs, you can't be sure someone somewhere will
not use an editor that you haven't ever heard of, or the same editor
with different settings, destroy the indentation by simply opening it
and then, finding you write lousy code, curse you and your children for
ten generations :).

That is one reason why GvR recommends strongly to use tabs *or* spaces,
but not both. In the case of Vim, there exists an often overlooked
command, 'retab' that allows you to fix such files. A judicious use of
'retab' and tabnanny.py (included in python's standard library) can
fix such disasters. I myself don't care if a python source code file has
tabs *or* spaces, I do care it is properly formatted and indented,
therefore it runs in *my* interpreter. Using spaces only is a warranty
it will happen so.
Ideally, I would like VIM to be smart enough (like
every other programmer's editor in the universe) to detect the current
tab settings in the file and use those.

Then you experience of the world is very limited :) I am aware of only
some very expensive commercial editors/IDEs that can do such thing in a
general way. X/Emacs, can insofar as you write the E-Lisp/CL/Python code
to do it. Vim can, insofar as you write the VimL, TCL, Python, Ruby,
Perl or MzScheme code to do it (probably someone has already written it,
but I haven't had the motivation to look for it. Search the community
sites; Vim's is at http://www.vim.org/).

If you have a vim binary linked to a python interpreter, you can write a
python/vim script that sniffs the file and sets options the way you like
by seting up a hook on the FileType autocmd event for python files.
(You could write it in VimL so that is as portable as possible, but I'm
trying to keep the post on topic ;-).

--
Alejandro López-Valencia
qenqhy ng rgo qbg arg qbg pb
http://dradul.tripod.com/
The limits of my language are the limits of my world.
(L. Wittgenstein)
 
B

Brian Quinlan

If you are starting with a file that already contains tabs *and* spaces,
I'd say you have already called upon you the gods of disaster.
> [snipped]

But I haven't. I did what you suggested, opened a file using ONLY tabs
for indentation and VIM stilled inserted spaces when it pressed the tab yet.

Then you experience of the world is very limited :) I am aware of only
some very expensive commercial editors/IDEs that can do such thing in a
general way.

Like PythonWin (free) or Eric3 (free)?

Cheers,
Brian
 
A

Alejandro =?iso-8859-1?Q?L=F3pez-Valencia?=

If you are starting with a file that already contains tabs *and* spaces,
I'd say you have already called upon you the gods of disaster.
[snipped]

But I haven't. I did what you suggested, opened a file using ONLY tabs
for indentation and VIM stilled inserted spaces when it pressed the tab yet.

Because that's what it is supposed to do. If you want to edit a tab
indented file, you make sure that expandtab is set (it is in the example
I gave) and type the ex command ':h retab! 4', assuming your file was
created with a hardware tab setting (ts) of 4. Now, your file uses only
spaces and indention settings will work. There are other alternatives to
what you want to do, type the ex command ":h 'tabstop'" in a Vim session
and you'll get the whole story.

As far as I know, only X/Emacs with python-mode.el has the kind of
mind-reading you want. And still you'll have to hand-hold it a bit. I
would suggest you explore JEdit and Jext. Both are Java-based editors
and at least Jext has an embedded Jython interpreter (there, desperately
trying to keep this post on topic ;-). Perhaps these editors already
know how to do what you want.i I don't know them well enough to say
anything about them.
Like PythonWin (free) or Eric3 (free)?

I did say "general way", didn't I? As in the way you can setup Visual
SlickEdit or CodeWright to do it for you. Hmm... I shouldn't have
deleted the words "dedicated IDEs" when writing that paragraph, as that
covers idle, PythonWin, Eric, and a few other editors (written in Python
+ some GUI API, and using tabnanny.py or tokenizer.py behind the scenes).

Cheers,

Alejo
--
Alejandro López-Valencia
qenqhy ng rgo qbg arg qbg pb
http://dradul.tripod.com/
The limits of my language are the limits of my world.
(L. Wittgenstein)
 
G

Graham Dumpleton

Brian Quinlan said:
Right now I'm working in an environment where tabs were mandated as the
indentation style for Python. I've managed to persuade everyone to
switch to 4 space indentation.

The problem is that we now have a migration problem. Most of our
develoeprs are using VIM which, AFAIK, is not intelligent enough to
detect the current indentation style of a file. Modifying all of our
source files at once to use spaces and then getting everyone to change
their .vimrc is a posibility but not desirable because everyone would
have to check in their work (whatever it's state) at the time of
migration. Does anyone have any suggestions? Ideally, there would be
some way to tell VIM to use the file's exsiting indentation style. That
way I could slowly switch to spaces over time.

I have the following to lines in my .exrc file:

map ^Ktu 1G!Gunexpand -a^M
map ^Kte 1G!Gexpand^M

The ^K and ^M are the equivalent control characters.

I then type ^Ke and it will pipe the whole contents of the file being edited
through "expand" which will turn all tabs into appropriate number of
spaces. Typing ^Ku does the opposite.

You could run the "expand" program outside of vi as well as part of a shell
script and do all your files at the same time.
 
S

Steve Lamb

I then type ^Ke and it will pipe the whole contents of the file being edited
through "expand" which will turn all tabs into appropriate number of
spaces. Typing ^Ku does the opposite.
You could run the "expand" program outside of vi as well as part of a shell
script and do all your files at the same time.

Couldn't they just also just add a global %s/\t/ /g to the loading of
..py files and be done with it? :)
 
D

David M. Cooke

At some point said:
Couldn't they just also just add a global %s/\t/ /g to the loading of
.py files and be done with it? :)

Not if you've mixed tabs and spaces. A tab isn't 8 spaces (or 4
spaces); it should move to the next tabstop, so for instance the '*'
line up in the following: *
 
G

Graham Dumpleton

map ^Ktu 1G!Gunexpand -a^M
map ^Kte 1G!Gexpand^M

The ^K and ^M are the equivalent control characters.

I then type ^Ke and it will pipe the whole contents of the file being edited
through "expand" which will turn all tabs into appropriate number of
spaces. Typing ^Ku does the opposite.

Whoops, that should read that I type ^Kte and ^Ktu respectively.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,197
Messages
2,571,040
Members
47,634
Latest member
RonnyBoelk

Latest Threads

Top