(py-execute-region): Make sure the new temporary buffer is current for
authorBarry Warsaw <barry@python.org>
Fri, 23 Jun 2000 20:24:25 +0000 (20:24 +0000)
committerBarry Warsaw <barry@python.org>
Fri, 23 Jun 2000 20:24:25 +0000 (20:24 +0000)
the insertion of the text.

Misc/python-mode.el

index 9906a52ba771c19182e903e2d6dbd0773a3e75c2..8a059f51decfb50c8a122c2fcba261a9f8dfd8a8 100644 (file)
@@ -1284,10 +1284,11 @@ 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)
-      (when (/= (py-point 'bol) (py-point 'boi))
+      (let ((needs-if (/= (py-point 'bol) (py-point 'boi))))
        (set-buffer buf)
-       (insert "if 1:\n"))
-      (insert-buffer-substring cur start end))
+       (when needs-if
+         (insert "if 1:\n"))
+       (insert-buffer-substring cur start end)))
     (cond
      ;; always run the code in its own asynchronous subprocess
      (async