mirror of https://github.com/python/cpython.git
(py-execute-region): Do the blank line skipping inside the
save-excursion so that when the function is complete, point is preserved.
This commit is contained in:
parent
39a86c2188
commit
69c9266f45
|
@ -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'."
|
is inserted at the end. See also the command `py-clear-queue'."
|
||||||
(interactive "r\nP")
|
(interactive "r\nP")
|
||||||
;; Skip ahead to the first non-blank line
|
;; 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))
|
(let* ((proc (get-process py-which-bufname))
|
||||||
(temp (if (memq 'broken-temp-names py-emacs-features)
|
(temp (if (memq 'broken-temp-names py-emacs-features)
|
||||||
(let
|
(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.
|
;; Write the contents of the buffer, watching out for indented regions.
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(goto-char start)
|
(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))))
|
(let ((needs-if (/= (py-point 'bol) (py-point 'boi))))
|
||||||
(set-buffer buf)
|
(set-buffer buf)
|
||||||
(python-mode)
|
(python-mode)
|
||||||
|
|
Loading…
Reference in New Issue