擅长:python、mysql、java
<pre><code>(defun send-buffer-to-ipython ()
"Send current buffer to the running ipython process."
(interactive)
(let* ((ipython-buffer "*ansi-term*") ; the buffer name of your running terminal
(proc (get-buffer-process ipython-buffer)))
(unless proc
(error "no process found"))
(save-buffer)
(process-send-string proc
(format "execfile(\"%s\")\n" (buffer-file-name)))
(pop-to-buffer ipython-buffer) ; show ipython and select it
;; (display-buffer ipython-buffer) ; show ipython but don't select it
))
</code></pre>
<p>然后将命令<code>send-buffer-to-ipython</code>绑定到您喜欢的任何键上。我把它绑定到<code>C-c C-c</code></p>
^{pr2}$