[Top][All Lists]

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

Re: python-shell-send-region uses wrong encoding?

From: Ernest Adrogué
Subject: Re: python-shell-send-region uses wrong encoding?
Date: Thu, 31 Oct 2013 15:30:12 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

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))

reply via email to

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