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 15:30:12 +0100 Message-ID: <20131031143012.GA4300@doriath.local> References: <20131029113044.GA28039@doriath.local> <5270AAF3.5040906@easy-emacs.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1383229852 24653 80.91.229.3 (31 Oct 2013 14:30:52 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 31 Oct 2013 14:30:52 +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 15:30:57 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 1VbtGx-0001v5-2F for geh-help-gnu-emacs@m.gmane.org; Thu, 31 Oct 2013 15:30:55 +0100 Original-Received: from localhost ([::1]:57349 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VbtGw-0006DI-Kt for geh-help-gnu-emacs@m.gmane.org; Thu, 31 Oct 2013 10:30:54 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54992) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VbtGd-0006CE-8n for help-gnu-emacs@gnu.org; Thu, 31 Oct 2013 10:30:43 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VbtGU-0005H3-Hm for help-gnu-emacs@gnu.org; Thu, 31 Oct 2013 10:30:35 -0400 Original-Received: from mail-we0-x230.google.com ([2a00:1450:400c:c03::230]:46766) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VbtGU-0005Gg-Ai for help-gnu-emacs@gnu.org; Thu, 31 Oct 2013 10:30:26 -0400 Original-Received: by mail-we0-f176.google.com with SMTP id w62so2726240wes.7 for ; Thu, 31 Oct 2013 07:30:25 -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=Qp6OH3DwC1yCVE97awAvMbEa8AwJbb74GNnNxz9D9Fw=; b=Un6RBA5AFz0OvuIzomHEYeMSuC3rjRBX8L2+rYQmfU+ZevsUOBkcE8H0ZWyvd6+oyh yxqF+KFGOuEQjaU+TxzqG60HPwqtYFni2M7wQuZw4yaqOKk7NDbehpdw400Lvh9uNbam HGskxOfFu4mW0bipeQCFmLau4XxnY16F05AbAUeWGiPOfMnz17XsvjQ784ZBR0wsiLcX PVsLWx/s9KTo/RECsRWRzFpBSpmMEhefBAlWkLHZCLRtGHQQlWfUaPOIXvdl2FCuHCzM nUOLuiJm8dkOGgBPpRCqsLIHJ19Wsja7P9/RWZ54dd2ZzQY2smec9TViP/IGsEXYQJ6S 8rfg== X-Received: by 10.194.187.171 with SMTP id ft11mr977034wjc.83.1383229824986; Thu, 31 Oct 2013 07:30:24 -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 dj8sm7325414wid.2.2013.10.31.07.30.22 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 31 Oct 2013 07:30:22 -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::230 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:94282 Archived-At: 30-10-2013, 07:37 (-0400); Stefan Monnier escriu: > This function is used to send a string (typically extracted from the > region) not a file, so the offsets have always been wrong anyway (except > when the region happens to start on the first line). The line number is right, because the temp file is filled with empty lines so that the line numbers match. Because of the extra line, it's one line off. This fixes it: --- python.el.orig 2013-10-31 15:21:26.000000000 +0100 +++ python.el 2013-10-31 15:19:03.673891453 +0100 @@ -2154,7 +2146,7 @@ 3. Wraps indented regions under an \"if True:\" block so the interpreter evaluates them correctly." (let ((substring (buffer-substring-no-properties start end)) - (fillstr (make-string (1- (line-number-at-pos start)) ?\n)) + (fillstr (make-string (- (line-number-at-pos start) 2) ?\n)) (toplevel-block-p (save-excursion (goto-char start) (or (zerop (line-number-at-pos start))