]> granicus.if.org Git - python/commitdiff
(py-execute-region): Alexander Schmolck points out that leading
authorBarry Warsaw <barry@python.org>
Thu, 25 Apr 2002 19:17:42 +0000 (19:17 +0000)
committerBarry Warsaw <barry@python.org>
Thu, 25 Apr 2002 19:17:42 +0000 (19:17 +0000)
whitespace can hose the needs-if test.  So just skip all blank lines
at the start of the region right off the bat.

Misc/python-mode.el

index f8b05f57bb8a86d525676805dec2085e85c2b41d..ba89cb4e8abe028659d51e7bcf0c0cb08f1eb324 100644 (file)
@@ -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))