From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ernest =?iso-8859-1?Q?Adrogu=E9?= Newsgroups: gmane.emacs.help Subject: Re: python-shell-send-region uses wrong encoding? Date: Thu, 31 Oct 2013 18:54:38 +0100 Message-ID: <20131031175438.GA5392@doriath.local> References: <20131029113044.GA28039@doriath.local> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1383242116 21959 80.91.229.3 (31 Oct 2013 17:55:16 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 31 Oct 2013 17:55:16 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Oct 31 18:55:20 2013 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VbwSl-00068d-Lp for geh-help-gnu-emacs@m.gmane.org; Thu, 31 Oct 2013 18:55:19 +0100 Original-Received: from localhost ([::1]:58660 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VbwSl-0003sU-AM for geh-help-gnu-emacs@m.gmane.org; Thu, 31 Oct 2013 13:55:19 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48931) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VbwSS-0003bF-2J for help-gnu-emacs@gnu.org; Thu, 31 Oct 2013 13:55:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VbwSJ-0003vP-Hq for help-gnu-emacs@gnu.org; Thu, 31 Oct 2013 13:55:00 -0400 Original-Received: from mail-we0-x22e.google.com ([2a00:1450:400c:c03::22e]:63002) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VbwSJ-0003vK-BZ for help-gnu-emacs@gnu.org; Thu, 31 Oct 2013 13:54:51 -0400 Original-Received: by mail-we0-f174.google.com with SMTP id u56so3064033wes.33 for ; Thu, 31 Oct 2013 10:54:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=excP4sI18+8sWT8jysQsI5TCOFTD6urIhb8TKVpDRkk=; b=gjMO9/57XuCEjTLsnPcm6A85xUg+YGUFEpbrhzYk/JH952dftJQuc59FAtNZLUGERK T8p3AJahFU/0uQqr5fx2EvKOiKTc9/Tlu2KXxha8OPRJf5zcbjScEze5xsNVjJ2bNEof 5M1HeNjJ6j2FH4jn3AIlePzd8L1sOYXk//+u9SrLY8n0iAqBJAZX2UE8qdaGIjY5KKxn z/hr6Pc+KnKUvWkeBrppMT+CglwQ1vTPZIX6sX8C48uMhsJIFN1xY/5XmEyt5q4Izeh+ 8T6iUyzfYtVRwHJBesbVaQ7KlQ+vir7LTvy6cMu/vsr/lVRl6vWbeOyR+ZlwutykrHtx u3vg== X-Received: by 10.194.94.137 with SMTP id dc9mr4192305wjb.38.1383242090461; Thu, 31 Oct 2013 10:54:50 -0700 (PDT) Original-Received: from doriath (200.Red-83-58-146.dynamicIP.rima-tde.net. [83.58.146.200]) by mx.google.com with ESMTPSA id d11sm410552wic.4.2013.10.31.10.54.48 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 31 Oct 2013 10:54:48 -0700 (PDT) Content-Disposition: inline In-Reply-To: X-Operating-System: GNU/Linux (Debian jessie/sid) User-Agent: Mutt/1.5.21 (2010-09-15) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c03::22e X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:94284 Archived-At: 29-10-2013, 23:20 (-0400); Stefan Monnier escriu: > I installed a variant of that patch in Emacs's trunk, which should fix > the problem. The original problem is fixed, but now there's another problem. Send this to Python: class Foo(object): pass and you get IndentationError. The problem seems to be this change: @@ -2034,26 +2038,32 @@ there for compatibility with CEDET.") (defun python-shell-send-string (string &optional process msg) "Send STRING to inferior Python PROCESS. -When MSG is non-nil messages the first line of STRING." +When MSG is non-nil messages the first line of STRING. +If a temp file is used, return its name, otherwise return nil." (interactive "sPython command: ") (let ((process (or process (python-shell-get-or-create-process))) - (lines (split-string string "\n" t))) - (and msg (message "Sent: %s..." (nth 0 lines))) - (if (> (length lines) 1) + (_ (string-match "\\`\n*\\(.*\\)\\(\n.\\)?" string)) + (multiline (match-beginning 2))) + (and msg (message "Sent: %s..." (match-string 1 string))) + (if multiline (let* ((temporary-file-directory