* progmodes/python.el (python-shell-send-string): When
authorMatt McClure <mlm@aya.yale.edu>
Fri, 7 Sep 2012 14:53:15 +0000 (16:53 +0200)
committerMichael Albinus <michael.albinus@gmx.de>
Fri, 7 Sep 2012 14:53:15 +0000 (16:53 +0200)
default-directory is remote, create temp file on remote
filesystem.
(python-shell-send-file): When file is remote, pass local view of
file paths to remote Python interpreter.  (Bug#12340)

lisp/ChangeLog
lisp/progmodes/python.el

index 95a6c1e..efdc0b8 100644 (file)
@@ -1,3 +1,11 @@
+2012-09-07  Matt McClure  <mlm@aya.yale.edu>  (tiny change)
+
+       * progmodes/python.el (python-shell-send-string): When
+       default-directory is remote, create temp file on remote
+       filesystem.
+       (python-shell-send-file): When file is remote, pass local view of
+       file paths to remote Python interpreter.  (Bug#12340)
+
 2012-09-07  Chong Yidong  <cyd@gnu.org>
 
        * window.el (switch-to-buffer): Doc fix (Bug#12181).
index 601850e..ffc6c1a 100644 (file)
@@ -1824,7 +1824,11 @@ When MSG is non-nil messages the first line of STRING."
         (lines (split-string string "\n" t)))
     (and msg (message "Sent: %s..." (nth 0 lines)))
     (if (> (length lines) 1)
-        (let* ((temp-file-name (make-temp-file "py"))
+        (let* ((temporary-file-directory
+                (if (file-remote-p default-directory)
+                    (concat (file-remote-p default-directory) "/tmp")
+                  temporary-file-directory))
+               (temp-file-name (make-temp-file "py"))
                (file-name (or (buffer-file-name) temp-file-name)))
           (with-temp-file temp-file-name
             (insert string)
@@ -1931,8 +1935,14 @@ FILE-NAME."
   (interactive "fFile to send: ")
   (let* ((process (or process (python-shell-get-or-create-process)))
          (temp-file-name (when temp-file-name
-                           (expand-file-name temp-file-name)))
-         (file-name (or (expand-file-name file-name) temp-file-name)))
+                           (expand-file-name
+                            (or (file-remote-p temp-file-name 'localname)
+                                temp-file-name))))
+         (file-name (or (when file-name
+                          (expand-file-name
+                           (or (file-remote-p file-name 'localname)
+                               file-name)))
+                        temp-file-name)))
     (when (not file-name)
       (error "If FILE-NAME is nil then TEMP-FILE-NAME must be non-nil"))
     (python-shell-send-string