=== modified file 'lisp/progmodes/python.el' --- lisp/progmodes/python.el 2012-06-17 08:53:31 +0000 +++ lisp/progmodes/python.el 2012-06-18 18:03:07 +0000 @@ -1328,6 +1328,16 @@ :type '(alist string) :group 'python) +(defcustom python-show-process-buffer-on-send nil + "If non-nil, show the process buffer after sending. +If the value is `current', show the process buffer in the current +window. If the value is `other', display it in another window." + :type '(choice (const :tag "No" nil) + (const :tag "In current window" current) + (const :tag "In another window" other)) + :group 'python + :version "24.2") + (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 +1602,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.