aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/progmodes/python.el
diff options
context:
space:
mode:
authorFabián Ezequiel Gallina2012-05-17 00:02:53 -0300
committerFabián Ezequiel Gallina2012-05-17 00:02:53 -0300
commit79dafa51ba09e8a5fc8f48b23b440388dd3596e8 (patch)
treee64d84251ba9fbf7014e1f71a3322dcb34ce2af1 /lisp/progmodes/python.el
parent66b0b492bcb40a7d0675ed3471da92aae4bde0ba (diff)
downloademacs-79dafa51ba09e8a5fc8f48b23b440388dd3596e8.tar.gz
emacs-79dafa51ba09e8a5fc8f48b23b440388dd3596e8.zip
python-shell-get-or-create-process preserves current buffer.
Diffstat (limited to 'lisp/progmodes/python.el')
-rw-r--r--lisp/progmodes/python.el4
1 files changed, 3 insertions, 1 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 6458c359355..37a4d029c0f 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -970,7 +970,8 @@ commands.)"
970 970
971(defun python-shell-get-or-create-process () 971(defun python-shell-get-or-create-process ()
972 "Get or create an inferior Python process for current buffer and return it." 972 "Get or create an inferior Python process for current buffer and return it."
973 (let* ((dedicated-proc-name (python-shell-get-process-name t)) 973 (let* ((old-buffer (current-buffer))
974 (dedicated-proc-name (python-shell-get-process-name t))
974 (dedicated-proc-buffer-name (format "*%s*" dedicated-proc-name)) 975 (dedicated-proc-buffer-name (format "*%s*" dedicated-proc-name))
975 (global-proc-name (python-shell-get-process-name nil)) 976 (global-proc-name (python-shell-get-process-name nil))
976 (global-proc-buffer-name (format "*%s*" global-proc-name)) 977 (global-proc-buffer-name (format "*%s*" global-proc-name))
@@ -982,6 +983,7 @@ commands.)"
982 (setq dedicated-running t) 983 (setq dedicated-running t)
983 (setq global-running t))) 984 (setq global-running t)))
984 ;; Always prefer dedicated 985 ;; Always prefer dedicated
986 (switch-to-buffer old-buffer)
985 (get-buffer-process (if dedicated-running 987 (get-buffer-process (if dedicated-running
986 dedicated-proc-buffer-name 988 dedicated-proc-buffer-name
987 global-proc-buffer-name)))) 989 global-proc-buffer-name))))