Switching from python-mode.el to python.el

For what it’s worth, I do not see the behavior you are seeing in issue #1, “Each buffer visiting a python file gets its own inferior interactive python shell.”

This is what I did using python.el from Emacs 22.2.

C-x C-f foo.py
[insert: print “foo”]

C-x C-f bar.py
[insert: print “bar”]

C-c C-z [*Python* buffer appears]

C-x o

C-c C-l RET [“bar” is printed in *Python*]

C-x b foo.py RET

C-c C-l RET [“foo” is printed in the same *Python* buffer]

Therefore the two files are sharing the same inferior python shell. Perhaps there is some unforeseen interaction between your personal customizations of python-mode and the default behaviors of python.el. Have you tried using python.el without your .emacs customizations and checking if it behaves the same way?

The major feature addition of python.el over python-mode is the symbol completion function python-complete-symbol. You can add something like this

(define-key inferior-python-mode-map "\C-c\t" 'python-complete-symbol)

Then typing

>>> import os
>>> os.f[C-c TAB]

you’ll get a *Completions* buffer containing

Click <mouse-2> on a completion to select it.
In this buffer, type RET to select the completion near point.

Possible completions are:
os.fchdir                          os.fdatasync
os.fdopen                          os.fork
os.forkpty                         os.fpathconf
os.fstat                           os.fstatvfs
os.fsync                           os.ftruncate

It’ll work in .py file buffers too.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)