From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Slawomir Nowaczyk Newsgroups: gmane.emacs.devel Subject: python-mode: make sure output is not eaten Date: Mon, 21 Aug 2006 22:16:56 +0200 Message-ID: <20060821220052.494C.SLAWOMIR.NOWACZYK.847@student.lu.se> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Trace: sea.gmane.org 1156191492 30527 80.91.229.2 (21 Aug 2006 20:18:12 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 21 Aug 2006 20:18:12 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Aug 21 22:18:10 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GFGDd-0005ui-2t for ged-emacs-devel@m.gmane.org; Mon, 21 Aug 2006 22:17:57 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GFGDc-0006CF-Ni for ged-emacs-devel@m.gmane.org; Mon, 21 Aug 2006 16:17:56 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GFGD0-00060m-MJ for emacs-devel@gnu.org; Mon, 21 Aug 2006 16:17:18 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GFGCx-00060B-Od for emacs-devel@gnu.org; Mon, 21 Aug 2006 16:17:18 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GFGCx-000608-KL for emacs-devel@gnu.org; Mon, 21 Aug 2006 16:17:15 -0400 Original-Received: from [130.235.16.11] (helo=himmelsborg.cs.lth.se) by monty-python.gnu.org with esmtp (Exim 4.52) id 1GFGKP-00009F-89 for emacs-devel@gnu.org; Mon, 21 Aug 2006 16:24:57 -0400 Original-Received: from [127.0.0.1] (slawek@dain [130.235.16.76]) by himmelsborg.cs.lth.se (8.13.6/8.13.6/perf-jw-tr) with ESMTP id k7LKH4gd008672 for ; Mon, 21 Aug 2006 22:17:04 +0200 (CEST) Original-To: emacs-devel@gnu.org X-Esmandil_Citation: done X-Mailer-Plugin: Popup Memopad for Becky!2 Ver.0.02 Rev.2 X-Mailer: Becky! ver. 2.25.02 [en] X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:58663 Archived-At: 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 ( slawomir.nowaczyk.847@student.lu.se ) If the code and the comments disagree, then both are probably wrong.