python-mode tab completion problem

T

test1dellboy3

Hi,

I am exploring python-mode on emacs. When I open foo.py in emacs and
hit C-!, it starts the python interpreter in another window. Next, I
execute -

import rlcompleter, readline
readline.parse_and_bind('tab: complete')

Now I will test the completion by trying to complete sys.v (which could
be sys.version or sys.version_info). It works find when I run the
python interpreter from a terminal, by in python-mode, I get -

import sys
sys.v [tab][enter]
'2.3.4 (#2, Jan 5 2005, 08:24:51) \n[GCC 3.3.5 (Debian 1:3.3.5-5)]'

sys.v [tab][tab][enter]
'2.3.4 (#2, Jan 5 2005, 08:24:51) \n[GCC 3.3.5 (Debian 1:3.3.5-5)]'

sys.v [tab][tab][[tab][enter]

sys.version sys.version_info
'2.3.4 (#2, Jan 5 2005, 08:24:51) \n[GCC 3.3.5 (Debian 1:3.3.5-5)]'

I see that it is doing the completion, but it doesn't show me the
choices before I hit enter, instead it moves the cursor one tab stop to
the right. Any ideas?

Thanks in advance
 
S

Skip Montanaro

test1dellboy3> I am exploring python-mode on emacs. When I open foo.py
test1dellboy3> in emacs and hit C-!, it starts the python interpreter in
test1dellboy3> another window. Next, I execute -

...

That's not really intended to be used as an interactive session with all
sorts of bells and whistles. If you want a true terminal emulator within
Emacs, try

M-x terminal-emulator RET

You can do tab completion and command recall just like a normal terminal.
(In fact, you can run Emacs within Emacs using terminal-emulator.)

Skip
 
F

Fernando Perez

Skip said:
test1dellboy3> I am exploring python-mode on emacs. When I open foo.py
test1dellboy3> in emacs and hit C-!, it starts the python interpreter in
test1dellboy3> another window. Next, I execute -

...

That's not really intended to be used as an interactive session with all
sorts of bells and whistles.

Or he can use ipython, which with the special ipython.el companion file and a
recent (CVS) python-mode, will give him true tab completion (with options
listed in an emacs *completions* buffer) for all objects.

With ipython's %pdb active, it will also open up the source at any uncaught
exception, at the line of the exception. Very handy for debugging.

Regards,

f

ps. All this fanciness is thanks to the sustained efforts of A. Schmolck and P.
Ramachandran, I'm just happy to use them (I can't code a line of elisp).
 

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
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top