Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IPython support on Emacs 24.x

I am confused about the integration of IPython with Emacs. Starting with Emacs 24, Emacs ships with it's own python.el. Does this file have support for IPython or just for Python?

Also, the Emacswiki talks about a file called IPython.el (although the link it provides: http://ipython.scipy.org/dist/ipython.el returns a 404 Error). Is this file compatible with Emacs 24' python.el or does it only work with python-model.el?

like image 499
Amelio Vazquez-Reina Avatar asked Nov 16 '12 18:11

Amelio Vazquez-Reina


2 Answers

The new python.el (shipped with Emacs version 24.3) does support IPython. You need to add the following lines to your init.el file (instructions copied from python.el):

(require 'python)
(setq
  python-shell-interpreter "ipython"
  python-shell-interpreter-args "--pylab"
  python-shell-prompt-regexp "In \\[[0-9]+\\]: "
  python-shell-prompt-output-regexp "Out\\[[0-9]+\\]: "
  python-shell-completion-setup-code
    "from IPython.core.completerlib import module_completion"
  python-shell-completion-module-string-code
    "';'.join(module_completion('''%s'''))\n"
  python-shell-completion-string-code
    "';'.join(get_ipython().Completer.all_completions('''%s'''))\n")

This works on Linux (I'm running Ubuntu 12.04), some additional modifications might be needed on Windows (for details, check the init.el source).

However, you should not use ipython.el (which is distributed with the IPython package), as it explicitly depends on python-mode.el (at least this is the case with IPython 0.12.1 which is installed on my system).

like image 141
damjan Avatar answered Sep 19 '22 05:09

damjan


Not certain about the stock python.el as I'm running python-mode.el, which has ipython support in it. But I just took a peek at the python.el sources which got installed with my Emacs 24 and it's got a few references to ipython inside it so it appears that it does support ipython.

like image 44
John Gaines Jr. Avatar answered Sep 18 '22 05:09

John Gaines Jr.