diff lisp/progmodes/python.el @ 76348:05d93f5e8286

(python-send-command): Restart proc if necessary. (python-proc): Simplify.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Mon, 05 Mar 2007 19:57:03 +0000
parents 985cc73beb79
children 6e293ce14a97 91bf6e05918b
line wrap: on
line diff
--- a/lisp/progmodes/python.el	Mon Mar 05 18:46:36 2007 +0000
+++ b/lisp/progmodes/python.el	Mon Mar 05 19:57:03 2007 +0000
@@ -1383,11 +1383,11 @@
 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 @@
   ;; 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.