Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

no completion in emacs by ipython(ipython.el) #721

Closed
sinoohe opened this Issue · 9 comments

2 participants

@sinoohe

hi
i have completion with TAB in shell by running ipython but in emacs when i run py-shell I have no completion
for example when I enter import[TAB] it says: can't find completion for "import"
i also imported rlcompleter2 but it doesn't work again!

cat ~/.ipython/ipy_user_conf.py
import rlcompleter2
rlcompleter2.setup()

i installed latest ipython version from the git repository
i tested both in emacs23 and emacs24(from git) [doesn't work]

@sinoohe

no solution?!!

@sinoohe sinoohe closed this
@sinoohe sinoohe reopened this
@jenshnielsen

It's still working for me sort of.
It does not appear to find the packages when trying to complete import
i.e. doing import sci[tab] does not find scipy and doing import [tab] gives import --------------------------------------------------.
But it works fine for completing functions of imported packages and also completes variables correctly.

It could be improved however as the ipython history will end up with a lot of stuff like:
print(';'.join(get_ipython().Completer.all_completions('sci'))) #PYTHON-MODE SILENT
when completing in the emacs shell.

@sinoohe

it doesn't work for me! also for function completion!also simple codes
for example :
a=[1,2,3]
a.[TAB]
no completion!!!!
is your ipython version or ipython.el in the latest version?!!
if not, can you send me your ipython and ipython.el?

@jenshnielsen

It's the latest version. I think that you also need python-mode.el (This is not the default python mode in emacs)
I am using version 5.20. (I have not tested the newest version but I guess it works)

The relevant part of my .emacs file to make it work is:

(autoload 'python-mode "python-mode" "Python Mode." t)
(setq auto-mode-alist (cons '("\\.py$" . python-mode) auto-mode-alist))
(setq interpreter-mode-alist (cons '("python" . python-mode)
                   interpreter-mode-alist))
(autoload 'python-mode "python-mode" "Python editing mode." t)
;;
;; In XEmacs syntax highlighting should be enabled automatically.  In GNU
;; Emacs you may have to add these lines to your init file:

(global-font-lock-mode t)
(setq font-lock-maximum-decoration t)
(require 'ipython)
(setq py-python-command-args '("--pylab=qt" "--colors=LightBG"))

(global-set-key [C-tab] 'ipython-complete) ;``` 
@sinoohe

i upgraded python-mode
now it says: py-shell::
Unknown option: --
usage: /usr/bin/python [option] ... [-c cmd | -m mod | file | -] [arg] ...
Try `python -h' for more information.

Process Python exited abnormally with code 2

I don't know what's happening

@jenshnielsen

Ok I see the same problem with the newest version of
python-mode try version 5.2 from here:
https://launchpad.net/python-mode/+download
That seems to work for me.

@sinoohe

ohhh! Yessss
Thank you so much
this version of python-mode works with ipython! i'm enjoying writing python in emacs :)

@sinoohe sinoohe closed this
@jenshnielsen

Just for the record. There seems to be bugs in new versions of python-mode see:
https://bugs.launchpad.net/python-mode/+bug/835151
The value of py-python-command is ignored.
so standard python is launched instead of ipython
As a workaround if you want to use the newest version of python-mode.el you can set
(setq py-default-interpreter "ipython") in your .emacs file

@jenshnielsen

Ok the new version seems seems to give other problems with tab indention as well.
I will not investigate it further until there is a new version of python-mode.el that fixes the first problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.