Skip to content
This repository has been archived by the owner on Mar 10, 2024. It is now read-only.

have ipython integration #16

Closed
aadis opened this issue Feb 21, 2011 · 4 comments
Closed

have ipython integration #16

aadis opened this issue Feb 21, 2011 · 4 comments

Comments

@aadis
Copy link

aadis commented Feb 21, 2011

Can we have support for ipython shell. Working tab completion would make it really snazzy!

@fgallina
Copy link
Owner

aadis, the way shell integration is implemented should make it possible to integrate this mode with any text based python shell around.

An untested way to make ipython work would be something like this in your .emacs:

(setq python-shell-interpreter "ipython")
(setq python-shell-interpreter-args "")
(setq python-shell-prompt-regexp "In \\[[0-9]+\\]: ")
(setq python-shell-block-prompt-regexp "Out\\[[0-9]+\\]: ")
(setq python-shell-completion-setup-code "")
(setq python-shell-completion-strings-code "';'.join(__IP.complete('''%s'''))\n")

Probably you'll find quirks, feel free to open issues for it :)

@fgallina
Copy link
Owner

aadis, I tested this and while it was working it was buggy.

Since commit aff95f77eba8801a2158b7d9f1a1f6af41d5755c you can make iPython work by adding this to your .emacs:

(setq
python-shell-interpreter "ipython"
python-shell-interpreter-args ""
python-shell-prompt-regexp "In [[0-9]+]: "
python-shell-prompt-output-regexp "Out[[0-9]+]: "
python-shell-completion-setup-code ""
python-shell-completion-string-code
"';'.join(__IP.complete('''%s'''))\n")

For me is working cool right now, give it a try and let me know.

@aadis
Copy link
Author

aadis commented Feb 25, 2011

Wow, fantastic. Works pretty well, all colors and what not too!

Though the tab completion in ipython is weird. It prints the name of the completion on a prompt and then prints the uncompleted text again on a new prompt.

I can provide more details if required.

But I'm pretty happy with the mode overall. Pretty clean. Thanks!

@fgallina
Copy link
Owner

With the latest revision and these settings is working OK for me:
(setq
python-shell-interpreter "ipython"
python-shell-interpreter-args ""
python-shell-prompt-regexp "In [[0-9]+]: "
python-shell-prompt-output-regexp "Out[[0-9]+]: "
python-shell-completion-setup-code ""
python-shell-completion-string-code "';'.join(__IP.complete('''%s'''))\n")

If it's not for you, then you should fill a bug :)

Try running emacs like this:

emacs -Q --eval "(progn (add-to-list 'load-path "~/path/to/python-mode") (require 'python))"

That will run a clean emacs with just the changes introduced by this python-mode.

Give it a try, if you can provide some recipe to it, that would be awesome.

Thanks for your words,
Fabián.

This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants