From 7c6152ff9eedabd45eb3e121387aae427a72b8b7 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Sat, 20 Nov 2004 20:39:16 +0000 Subject: [PATCH] (python-switch-to-python): If Python isn't running, start it. --- lisp/progmodes/python.el | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 9be2c7599b..016e84270d 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -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)))) -- 2.39.2