]> granicus.if.org Git - python/commitdiff
(py-execute-region): Do the blank line skipping inside the
authorBarry Warsaw <barry@python.org>
Sun, 12 May 2002 17:37:46 +0000 (17:37 +0000)
committerBarry Warsaw <barry@python.org>
Sun, 12 May 2002 17:37:46 +0000 (17:37 +0000)
save-excursion so that when the function is complete, point is
preserved.

Misc/python-mode.el

index b242f3b6770480a00371ffd9ee1645583aa6e434..ec997c26dea5d5f2b8e579a73d5d1138c342a309 100644 (file)
@@ -1495,14 +1495,6 @@ 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))
         (temp (if (memq 'broken-temp-names py-emacs-features)
                   (let
@@ -1520,6 +1512,13 @@ is inserted at the end.  See also the command `py-clear-queue'."
     ;; Write the contents of the buffer, watching out for indented regions.
     (save-excursion
       (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 ((needs-if (/= (py-point 'bol) (py-point 'boi))))
        (set-buffer buf)
        (python-mode)