将代码从Python缓冲区发送到从M-x ansi-term运行的IPython会话 [英] Sending code from Python buffer to IPython session running from M-x ansi-term
问题描述
M-x ansi-term
打开终端模拟器。这在Emacs中使用我选择的shell打开一个缓冲区。说我然后从这个shell运行 ipython
。可以从Emacs中的Python代码的另一个缓冲区发送代码到这个 ipython
会话吗?如果是这样的话我有一个小的模式为此目的(除了它不是IPython特定的,我大都使用它对于shell脚本): isend-mode 。
这是你如何使用它:
-
打开一个
ansi-term
buffer:
Mx
ansi-term
RET/ usr / bin / ipython
RET -
使用您要执行的代码打开缓冲区,并将其与解释器缓冲区相关联:
Mx
isend-准
RET* ANSI-术语*
RET -
在python缓冲区中点击 C-RET ,将当前行发送到
ansi-term
缓冲区。
Say I open a terminal emulator in Emacs with M-x ansi-term
. This opens a buffer in Emacs with the shell of my choice. Say I then run ipython
from this shell. Can I send code to this ipython
session from another buffer with Python code in Emacs? If so how?
I have a minor mode for this purpose (except it is not IPython-specific and I mostly use it for shell scripts): isend-mode.
Here is how you would use it:
Open an
ansi-term
buffer:M-x
ansi-term
RET/usr/bin/ipython
RETOpen the buffer with the code you want to execute, and associate it to the interpreter buffer:
M-x
isend-associate
RET*ansi-term*
RETHit C-RET in the python buffer to send the current line to the interpreter in the
ansi-term
buffer.
这篇关于将代码从Python缓冲区发送到从M-x ansi-term运行的IPython会话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!