(python-send-command): Restart proc if necessary.

(python-proc): Simplify.
This commit is contained in:
Stefan Monnier 2007-03-05 19:57:03 +00:00
parent 2c5b1db7f5
commit 86a3e45eea
2 changed files with 40 additions and 33 deletions

View file

@ -1383,11 +1383,11 @@ buffer for a list of commands.)"
COMMAND should be a single statement."
;; (assert (not (string-match "\n" command)))
;; (let ((end (marker-position (process-mark (python-proc)))))
(with-current-buffer python-buffer (goto-char (point-max)))
(with-current-buffer (process-buffer (python-proc))
(goto-char (point-max))
(compilation-forget-errors)
(python-send-string command)
(with-current-buffer python-buffer
(setq compilation-last-buffer (current-buffer)))
(setq compilation-last-buffer (current-buffer)))
;; No idea what this is for but it breaks the call to
;; compilation-fake-loc in python-send-region. -- Stef
;; Must wait until this has completed before re-setting variables below.
@ -1517,9 +1517,9 @@ See variable `python-buffer'. Starts a new process if necessary."
;; isn't one for `python-buffer'.
(unless (comint-check-proc python-buffer)
(run-python nil t))
(get-buffer-process (or (if (derived-mode-p 'inferior-python-mode)
(current-buffer)
python-buffer))))
(get-buffer-process (if (derived-mode-p 'inferior-python-mode)
(current-buffer)
python-buffer)))
(defun python-set-proc ()
"Set the default value of `python-buffer' to correspond to this buffer.