]> git.eshelyaron.com Git - emacs.git/commitdiff
* progmodes/python.el (python-shell-send-region): Add blank lines
authorFabián Ezequiel Gallina <fgallina@gnu.org>
Sat, 29 Dec 2012 12:33:33 +0000 (09:33 -0300)
committerFabián Ezequiel Gallina <fgallina@gnu.org>
Sat, 29 Dec 2012 12:33:33 +0000 (09:33 -0300)
for non sent code so backtraces remain correct.

lisp/ChangeLog
lisp/progmodes/python.el

index d37ee561fc3f96913c7c04023c484e159bbcbe92..9a54639a30b3021735312659d7244387dbbe56df 100644 (file)
@@ -1,3 +1,8 @@
+2012-12-29  Fabián Ezequiel Gallina  <fgallina@cuca>
+
+       * progmodes/python.el (python-shell-send-region): Add blank lines
+       for non sent code so backtraces remain correct.
+
 2012-12-29  Fabián Ezequiel Gallina  <fgallina@cuca>
 
        * progmodes/python.el: Remove cl dependency.
index 56a971f0c670e3dbe7b9de1d10f225a3148cd0ae..a427e95c0372497bb72c16aa6d437b96d02ea378 100644 (file)
@@ -2008,7 +2008,14 @@ Returns the output.  See `python-shell-send-string-no-output'."
 (defun python-shell-send-region (start end)
   "Send the region delimited by START and END to inferior Python process."
   (interactive "r")
-  (python-shell-send-string (buffer-substring start end) nil t))
+  (python-shell-send-string
+   (concat
+    (let ((line-num (line-number-at-pos start)))
+      ;; When sending a region, add blank lines for non sent code so
+      ;; backtraces remain correct.
+      (make-string (1- line-num) ?\n))
+    (buffer-substring start end))
+   nil t))
 
 (defun python-shell-send-buffer (&optional arg)
   "Send the entire buffer to inferior Python process.