=== modified file 'lisp/progmodes/python.el' --- lisp/progmodes/python.el 2012-06-17 08:53:31 +0000 +++ lisp/progmodes/python.el 2012-06-17 20:30:39 +0000 @@ -1328,6 +1328,15 @@ :type '(alist string) :group 'python) +(defcustom python-show-process-buffer-on-send nil + "Whether or not to show the Python process buffer after sending +a region to the Python process." + :type '(choice (const :tag "No" nil) + (const :tag "In current window" current) + (const :tag "In another window" other)) + :group 'python + :version "24.1") + (defun python-shell-get-process-name (dedicated) "Calculate the appropriate process name for inferior Python process. If DEDICATED is t and the variable `buffer-file-name' is non-nil @@ -1592,7 +1601,11 @@ (comint-send-string process string) (when (or (not (string-match "\n$" string)) (string-match "\n[ \t].*\n?$" string)) - (comint-send-string process "\n"))))) + (comint-send-string process "\n"))) + (cond ((eq python-show-process-buffer-on-send 'other) + (switch-to-buffer-other-window (current-buffer))) + ((eq python-show-process-buffer-on-send 'current) + (switch-to-buffer (current-buffer)))))) (defun python-shell-send-string-no-output (string &optional process msg) "Send STRING to PROCESS and inhibit output.