How to quickly create a IPython shell in Emacs?

烈酒焚心 提交于 2019-12-11 12:47:14

问题


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.


回答1:


Here's the code:

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

Also, smex makes it even faster to start.




回答2:


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.



来源:https://stackoverflow.com/questions/19495889/how-to-quickly-create-a-ipython-shell-in-emacs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!