emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r117592: Grab all Python process output before infer


From: Fabián Ezequiel Gallina
Subject: [Emacs-diffs] trunk r117592: Grab all Python process output before inferior-python-mode hooks.
Date: Mon, 28 Jul 2014 02:47:45 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 117592
revision-id: address@hidden
parent: address@hidden
committer: Fabián Ezequiel Gallina <address@hidden>
branch nick: trunk
timestamp: Sun 2014-07-27 23:47:29 -0300
message:
  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.
modified:
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/progmodes/python.el       python.el-20091113204419-o5vbwnq5f7feedwu-3008
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2014-07-28 01:41:29 +0000
+++ b/lisp/ChangeLog    2014-07-28 02:47:29 +0000
@@ -1,5 +1,14 @@
 2014-07-28  Fabián Ezequiel Gallina  <address@hidden>
 
+       Grab all Python process output before inferior-python-mode hooks.
+       * 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.
+
+2014-07-28  Fabián Ezequiel Gallina  <address@hidden>
+
        More robust shell startup and code setup.
        * progmodes/python.el (python-shell-make-comint): Remove
        accept-process-output call.

=== modified file 'lisp/progmodes/python.el'
--- a/lisp/progmodes/python.el  2014-07-28 01:41:29 +0000
+++ b/lisp/progmodes/python.el  2014-07-28 02:47:29 +0000
@@ -2361,7 +2361,10 @@
   (make-local-variable 'python-shell-internal-last-output)
   (when python-shell-font-lock-enable
     (python-shell-font-lock-turn-on))
-  (compilation-shell-minor-mode 1))
+  (compilation-shell-minor-mode 1)
+  ;; Ensure all the output is accepted before running any hooks.
+  (accept-process-output (get-buffer-process (current-buffer)))
+  (sit-for 0.1 t))
 
 (defun python-shell-make-comint (cmd proc-name &optional pop internal)
   "Create a Python shell comint buffer.
@@ -2499,13 +2502,7 @@
          (proc-buffer-name (format " *%s*" proc-name)))
     (when (not (process-live-p proc-name))
       (run-python-internal)
-      (setq python-shell-internal-buffer proc-buffer-name)
-      ;; XXX: Why is this `sit-for' needed?
-      ;; `python-shell-make-comint' calls `accept-process-output'
-      ;; already but it is not helping to get proper output on
-      ;; 'gnu/linux when the internal shell process is not running and
-      ;; a call to `python-shell-internal-send-string' is issued.
-      (sit-for 0.1 t))
+      (setq python-shell-internal-buffer proc-buffer-name))
     (get-buffer-process proc-buffer-name)))
 
 (define-obsolete-function-alias


reply via email to

[Prev in Thread] Current Thread [Next in Thread]