Created
July 19, 2013 15:44
-
-
Save ydm/6040155 to your computer and use it in GitHub Desktop.
Send current buffer to a freshly made python shell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun y:python-run () | |
(interactive) | |
(let* ((dedicated-proc-name (python-shell-get-process-name t)) | |
(dedicated-proc-buffer-name (format "*%s*" dedicated-proc-name)) | |
(dedicated-running (comint-check-proc dedicated-proc-buffer-name))) | |
;; If there's already a python shell running for this buffer, kill it | |
(when dedicated-running | |
(let* ((process (python-shell-get-or-create-process)) | |
(buffer (process-buffer process))) | |
(set-process-query-on-exit-flag process nil) | |
(kill-buffer buffer))) | |
;; Start new python shell | |
(run-python python-shell-interpreter t) | |
(python-shell-send-buffer t))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment