diff Misc/python-mode.el @ 23275:d47290dd2d57 legacy-trunk

(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.
author Barry Warsaw <barry@python.org>
date Thu, 25 Apr 2002 19:17:42 +0000
parents 803e6a695306
children 314e08e8090f
line wrap: on
line diff
--- a/Misc/python-mode.el	Thu Apr 25 17:29:45 2002 +0000
+++ b/Misc/python-mode.el	Thu Apr 25 19:17:42 2002 +0000
@@ -1378,6 +1378,13 @@
 
 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))