unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Slawomir Nowaczyk <slawomir.nowaczyk.847@student.lu.se>
Subject: python-mode: make sure output is not eaten
Date: Mon, 21 Aug 2006 22:16:56 +0200	[thread overview]
Message-ID: <20060821220052.494C.SLAWOMIR.NOWACZYK.847@student.lu.se> (raw)

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.

             reply	other threads:[~2006-08-21 20:16 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-21 20:16 Slawomir Nowaczyk [this message]
2006-08-22  6:10 ` python-mode: make sure output is not eaten Stefan Monnier
2006-08-22 18:26   ` Slawomir Nowaczyk
2006-08-23  4:04     ` Stefan Monnier
2006-08-25  0:18       ` Steven Huwig
2006-08-25  0:34         ` Steven Huwig
2006-08-25  1:29         ` Steven Huwig
2006-08-25  9:03         ` Slawomir Nowaczyk
2006-08-25 19:53         ` Ken Manheimer
2006-08-25 20:10           ` Stefan Monnier
2006-08-25  9:03       ` Slawomir Nowaczyk
2006-08-25 22:53         ` Stefan Monnier
2006-08-26 12:41           ` Slawomir Nowaczyk
2006-08-26 14:48             ` Stefan Monnier
2006-08-26 22:22               ` Slawomir Nowaczyk
2006-08-28 21:43                 ` Stefan Monnier
2006-08-30 21:08                   ` Slawomir Nowaczyk
2006-08-30 22:10                     ` Stefan Monnier
2006-08-31 11:19                       ` Slawomir Nowaczyk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060821220052.494C.SLAWOMIR.NOWACZYK.847@student.lu.se \
    --to=slawomir.nowaczyk.847@student.lu.se \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).