]> code.delx.au - gnu-emacs/commitdiff
(python-switch-to-python): If Python isn't running, start it.
authorRichard M. Stallman <rms@gnu.org>
Sat, 20 Nov 2004 20:39:16 +0000 (20:39 +0000)
committerRichard M. Stallman <rms@gnu.org>
Sat, 20 Nov 2004 20:39:16 +0000 (20:39 +0000)
lisp/progmodes/python.el

index 9be2c7599b8de9f6961e40374eff451dbb9364e7..016e84270db56a27344f13ed5db2065b405bc05a 100644 (file)
@@ -1235,9 +1235,13 @@ to this as appropriate.  Runs the hook `inferior-python-mode-hook'
   "Switch to the Python process buffer.
 With prefix arg, position cursor at end of buffer."
   (interactive "P")
-  (if (get-buffer python-buffer)
-      (pop-to-buffer python-buffer)
-    (error "No current process buffer.  See variable `python-buffer'"))
+  ;; Start python unless we have a buffer.
+  (unless (and python-buffer
+              (get-buffer python-buffer))
+    (run-python nil t))
+  (pop-to-buffer python-buffer)
+  ;; Make extra sure python is running in this buffer.
+  (python-proc)
   (when eob-p
     (push-mark)
     (goto-char (point-max))))