summaryrefslogtreecommitdiffstats
path: root/Misc
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2002-04-25 19:17:42 (GMT)
committerBarry Warsaw <barry@python.org>2002-04-25 19:17:42 (GMT)
commit4aab68e1c1dd821ced07ab0e8fa62d08cc0b42df (patch)
tree8825660b288e66caadf877a0ce50f85a716fb28c /Misc
parent69d31b749d79c9831201ab5dd72411062bcb2b1c (diff)
downloadcpython-4aab68e1c1dd821ced07ab0e8fa62d08cc0b42df.zip
cpython-4aab68e1c1dd821ced07ab0e8fa62d08cc0b42df.tar.gz
cpython-4aab68e1c1dd821ced07ab0e8fa62d08cc0b42df.tar.bz2
(py-execute-region): Alexander Schmolck points out that leading
whitespace can hose the needs-if test. So just skip all blank lines at the start of the region right off the bat.
Diffstat (limited to 'Misc')
-rw-r--r--Misc/python-mode.el7
1 files changed, 7 insertions, 0 deletions
diff --git a/Misc/python-mode.el b/Misc/python-mode.el
index f8b05f5..ba89cb4 100644
--- a/Misc/python-mode.el
+++ b/Misc/python-mode.el
@@ -1378,6 +1378,13 @@ window) so you can see it, and a comment of the form
is inserted at the end. See also the command `py-clear-queue'."
(interactive "r\nP")
+ ;; Skip ahead to the first non-blank line
+ (goto-char start)
+ (beginning-of-line)
+ (while (and (looking-at "\\s *$")
+ (< (point) end))
+ (forward-line 1))
+ (setq start (point))
(or (< start end)
(error "Region is empty"))
(let* ((proc (get-process py-which-bufname))