From: Fabián Ezequiel Gallina Date: Thu, 17 May 2012 03:02:53 +0000 (-0300) Subject: python-shell-get-or-create-process preserves current buffer. X-Git-Tag: emacs-24.2.90~1199^2~630 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=79dafa51ba09e8a5fc8f48b23b440388dd3596e8;p=emacs.git python-shell-get-or-create-process preserves current buffer. --- 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.)" (defun python-shell-get-or-create-process () "Get or create an inferior Python process for current buffer and return it." - (let* ((dedicated-proc-name (python-shell-get-process-name t)) + (let* ((old-buffer (current-buffer)) + (dedicated-proc-name (python-shell-get-process-name t)) (dedicated-proc-buffer-name (format "*%s*" dedicated-proc-name)) (global-proc-name (python-shell-get-process-name nil)) (global-proc-buffer-name (format "*%s*" global-proc-name)) @@ -982,6 +983,7 @@ commands.)" (setq dedicated-running t) (setq global-running t))) ;; Always prefer dedicated + (switch-to-buffer old-buffer) (get-buffer-process (if dedicated-running dedicated-proc-buffer-name global-proc-buffer-name))))