1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

* progmodes/python.el (python-shell-send-region): Add blank lines

for non sent code so backtraces remain correct.
This commit is contained in:
Fabián Ezequiel Gallina 2012-12-29 09:33:33 -03:00
parent 66164d2f17
commit 16768034b2
2 changed files with 13 additions and 1 deletions

View 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.