How to quickly create a IPython shell in Emacs?

2019-08-01 08:15发布

When I do python development in emacs, I want an IPython shell available. Here is my current way of accomplishing this:

M-x ansi-term

Which prompts me with Run program: /bin/bash, which I replace with /usr/bin/ipython

It's often the case that I want another terminal in emacs, perhaps to run the app, so I do:

M-x rename-buffer

and change the name of the buffer to ipython so that I can change buffers easily, with having to remember which terminal was the IPython shell.

It seems that there would be a way to create an emacs command that would accomplish all of this with a few keystrokes, but I don't know the right way to begin, being fairly inexperienced with Emacs.

2条回答
smile是对你的礼貌
2楼-- · 2019-08-01 08:27

Here's the code:

(defun ipython ()
  (interactive)
  (ansi-term "/usr/bin/ipython" "ipython"))

Also, smex makes it even faster to start.

查看更多
Anthone
3楼-- · 2019-08-01 08:47

Suggest to run IPython from a python-mode.

M-x ipython RET would be sufficient if python-mode.el is loaded.

python.el comes with comments in head how to configure, so M-x run-python RET will open an properly named IPython-shell buffer.

查看更多
登录 后发表回答