emacs-devel
[Top][All Lists]
Advanced

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

python-mode: make sure output is not eaten


From: Slawomir Nowaczyk
Subject: python-mode: make sure output is not eaten
Date: Mon, 21 Aug 2006 22:16:56 +0200

Hello,

the following path makes sure python-mode doesn't eat output coming
from the Python process. Without it, calling python-send-buffer on
a Python script which produces output, such as simple

   print 'OK'

wouldn't show anything in Inferior Python buffer -- the output would
get eaten by the python-preoutput-filter together with the
"_emacs_out" sentinel (at least on my machine... there seems to be a
race condition, because output was showing just fine when I run
python-send-command under edebug).

Anyway, this patch makes sure that output is printed when necessary.

**********************************************************************

--- EmacsCVS/lisp/progmodes/python.el       2006-08-21 10:03:44.950083200 +0200
+++ Emacs/lisp/progmodes/python.el   2006-08-21 21:58:30.049228800 +0200
@@ -1282,7 +1282,7 @@
          "")
         ((string-match "_emacs_out \\(.*\\)\n" s)
          (setq python-preoutput-result (match-string 1 s))
-         "")
+         (substring s 0 (match-beginning 0)))
        ((string-match ".*\n" s)
         s)
        ((or (eq t (compare-strings s nil nil "_emacs_ok\n" nil (length s)))
@@ -1409,7 +1409,7 @@
   "Evaluate STRING in inferior Python process."
   (interactive "sPython command: ")
   (comint-send-string (python-proc) string)
-  (comint-send-string (python-proc) "\n\n"))
+  (comint-send-string (python-proc) "\n"))

 (defun python-send-buffer ()
   "Send the current buffer to the inferior Python process."

**********************************************************************

-- 
 Best wishes,
   Slawomir Nowaczyk
     ( address@hidden )

If the code and the comments disagree, then both are probably wrong.





reply via email to

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