4

This is an issue with lots of related questions but none seems to work out for me. I need to use IPython in a similar way as I use M-xshell, but of course with python-related completion. The solution by abo-abo in this previous question How to open IPython interpreter in emacs? does the trick. However, it has the secondary effect of disabling keybindings when I am in the IPython buffer (i.e. I cannot, for example, change buffers with C-xo). Is there any easy way of solving this?

Code from previous answer:

(defun ipython ()
  (interactive)
  (term "/usr/bin/ipython"))
Community
  • 1
  • 1
jmlorenzi
  • 163
  • 5
  • related to [How can I unbind C-tab from jedi:complete?](http://stackoverflow.com/q/21131372/1309352) – Bleeding Fingers Jan 15 '14 at 09:59
  • I just tried with `emacs -q` and `C-x o` works. Any other key bindings don't work? – abo-abo Jan 15 '14 at 10:45
  • I don't know why, but in my case no key binding seem to work (`C-x o`, `C-x C-f`, `C-x k`) even launching emacs with `emacs -q`. The minibuffer also doesn't show any activity (i.e. does not display "C-x" if I press so...). EDIT: If I end the ipython process (i.e. type `exit` to the prompt) the key bindings become functional again. – jmlorenzi Jan 15 '14 at 16:03

3 Answers3

0

Just to give you an idea that it's possible to use M-x shell with ipython:

(let ((explicit-shell-file-name "/usr/bin/ipython"))
  (shell))

But now tab completion doesn't work. Maybe there is a solution to this, I'm not sure.

I prefer ansi-term to shell somehow. By the way, did you know that C-c C-j calls term-line-mode in ansi-term? C-c C-k switches back to the default term-char-mode. In term-line-mode you can move about the buffer with usual navigation bindings etc.

abo-abo
  • 20,038
  • 3
  • 50
  • 71
  • I don't know if that is what you meant, but I can use `C-c C-j` to recover normal keybindings for the ipython shell from your original answer. However TAB-completion does not work when on `term-line-model` TAB-completion does not work.Personally, I prefer `M-x shell` and would like a ipython buffer that works like it, but this is a good solution for the moment. – jmlorenzi Jan 16 '14 at 08:57
0

Maybe give python-mode.el a try. M-x ipython RET should do it than.

Andreas Röhler
  • 4,804
  • 14
  • 18
0

the code you posted but insted use ansi-term:

(defun ipython ()
  (interactive)
  (ansi-term "/usr/bin/ipython"))
BenyaR
  • 21
  • 2