summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2002-05-12 17:37:46 (GMT)
committerBarry Warsaw <barry@python.org>2002-05-12 17:37:46 (GMT)
commit69c9266f45fa56070b09cd2507fff595caa2760e (patch)
tree87c131589b72e06d0dc6c9d49be0cb0eb570b4c2
parent39a86c2188b22818c187e860fbf7d77a28a6a116 (diff)
downloadcpython-69c9266f45fa56070b09cd2507fff595caa2760e.zip
cpython-69c9266f45fa56070b09cd2507fff595caa2760e.tar.gz
cpython-69c9266f45fa56070b09cd2507fff595caa2760e.tar.bz2
(py-execute-region): Do the blank line skipping inside the
save-excursion so that when the function is complete, point is preserved.
-rw-r--r--Misc/python-mode.el15
1 files changed, 7 insertions, 8 deletions
diff --git a/Misc/python-mode.el b/Misc/python-mode.el
index b242f3b..ec997c2 100644
--- a/Misc/python-mode.el
+++ b/Misc/python-mode.el
@@ -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)