help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Inferior Python mode completion


From: Андрей Парамонов
Subject: Inferior Python mode completion
Date: Fri, 12 Nov 2010 00:14:44 +0300

Hello Emacs hackers!

Recently I'm investigating the possibility to use Emacs as Python IDE.
I have used Emacs for a long time and I wish continue to do so when
developing in Python.

So far I've tried built-in python.el, CEDET in Emacs 23.2 and latest
trunk, and python-mode.el. From these, built-in python.el seems the
best. It's consistent with other Emacs modes and has very decent
completion. However I fail to see how to enable completion in Python
interpreter buffer. I thought it would be easy as completion already
works in Python mode, but no luck :-(

I tried to copy-paste the following lines from \\{python-mode-map} to
\\{inferior-python-mode-map}:

(add-hook 'completion-at-point-functions
          'python-completion-at-point nil 'local)

and I got a completion, sort of. In Python interpreter buffer upon
M-Tab I would get multiple _emacs_out traces, like the following:

>>> _emacs_out ( "os" )
>>> _emacs_out ( "os.path.pardir" "os.path._varprog" "os.path.sameopenfile" 
>>> "os.path.exists" "os.path.realpath" "os.path.splitext" "os.path.basename" 
>>> "os.path.walk" "os.path.expandvars" "os.path.altsep" "os.path.expanduser" 
>>> "os.path.getmtime" "os.path.defpath" "os.path.dirname" "os.path.isfile" 
>>> "os.path.supports_unicode_filenames" "os.path.__all__" "os.path.sep" 
>>> "os.path.pathsep" "os.path.__class__" "os.path.__package__" 
>>> "os.path.getsize" "os.path.samestat" "os.path.curdir" "os.path.devnull" 
>>> "os.path.abspath" "os.path.islink" "os.path.relpath" "os.path.samefile" 
>>> "os.path.genericpath" "os.path.stat" "os.path.commonprefix" 
>>> "os.path.normpath" "os.path.__builtins__" "os.path.__file__" 
>>> "os.path.normcase" "os.path.extsep" "os.path.__name__" "os.path.getatime" 
>>> "os.path.lexists" "os.path.isdir" "os.path.join" "os.path.split" 
>>> "os.path.getctime" "os.path.isabs" "os.path.__doc__" "os.path.ismount" 
>>> "os.path.splitdrive" "os.path.warnings" "os.path._resolve_link" 
>>> "os.path.os" )

I'm not very good at (e)lisp, but after reading code in python.el and
a bit of googling I understand that Emacs installs a kind of hook into
Python interpreter by loading package "emacs". It looks like that hook
works nicely but Emacs cannot correctly handle it's output in my case.

It would be great if someone with better knowledge of Emacs'
architecture could point me where to dig.

Any hint appreciated,
Andrey Paramonov



reply via email to

[Prev in Thread] Current Thread [Next in Thread]