aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/progmodes/python.el
diff options
context:
space:
mode:
authorFabián Ezequiel Gallina2014-07-27 23:47:29 -0300
committerFabián Ezequiel Gallina2014-07-27 23:47:29 -0300
commitf5bed1021b782347c4f57449c8f7825a9a5f2bf6 (patch)
treea3f9c0cc169aff5e295aa5824f056533820bf0df /lisp/progmodes/python.el
parent168f8e732dcea276214823fea9c309b6b8b679f0 (diff)
downloademacs-f5bed1021b782347c4f57449c8f7825a9a5f2bf6.tar.gz
emacs-f5bed1021b782347c4f57449c8f7825a9a5f2bf6.zip
Grab all Python process output before inferior-python-mode hooks.
* lisp/progmodes/python.el (inferior-python-mode): Call accept-process-output and sit-for to ensure all output for process has been received before running hooks. (python-shell-internal-get-or-create-process): Cleanup accept-process-output and sit-for calls.
Diffstat (limited to 'lisp/progmodes/python.el')
-rw-r--r--lisp/progmodes/python.el13
1 files changed, 5 insertions, 8 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 433dbc1dafd..a3e100f0578 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -2361,7 +2361,10 @@ variable.
2361 (make-local-variable 'python-shell-internal-last-output) 2361 (make-local-variable 'python-shell-internal-last-output)
2362 (when python-shell-font-lock-enable 2362 (when python-shell-font-lock-enable
2363 (python-shell-font-lock-turn-on)) 2363 (python-shell-font-lock-turn-on))
2364 (compilation-shell-minor-mode 1)) 2364 (compilation-shell-minor-mode 1)
2365 ;; Ensure all the output is accepted before running any hooks.
2366 (accept-process-output (get-buffer-process (current-buffer)))
2367 (sit-for 0.1 t))
2365 2368
2366(defun python-shell-make-comint (cmd proc-name &optional pop internal) 2369(defun python-shell-make-comint (cmd proc-name &optional pop internal)
2367 "Create a Python shell comint buffer. 2370 "Create a Python shell comint buffer.
@@ -2499,13 +2502,7 @@ there for compatibility with CEDET.")
2499 (proc-buffer-name (format " *%s*" proc-name))) 2502 (proc-buffer-name (format " *%s*" proc-name)))
2500 (when (not (process-live-p proc-name)) 2503 (when (not (process-live-p proc-name))
2501 (run-python-internal) 2504 (run-python-internal)
2502 (setq python-shell-internal-buffer proc-buffer-name) 2505 (setq python-shell-internal-buffer proc-buffer-name))
2503 ;; XXX: Why is this `sit-for' needed?
2504 ;; `python-shell-make-comint' calls `accept-process-output'
2505 ;; already but it is not helping to get proper output on
2506 ;; 'gnu/linux when the internal shell process is not running and
2507 ;; a call to `python-shell-internal-send-string' is issued.
2508 (sit-for 0.1 t))
2509 (get-buffer-process proc-buffer-name))) 2506 (get-buffer-process proc-buffer-name)))
2510 2507
2511(define-obsolete-function-alias 2508(define-obsolete-function-alias