From 9dd40b000598aff88c6249ecf2b5a866935e9321 Mon Sep 17 00:00:00 2001 From: Matt McClure Date: Fri, 7 Sep 2012 16:53:15 +0200 Subject: [PATCH] * 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) --- lisp/ChangeLog | 8 ++++++++ lisp/progmodes/python.el | 16 +++++++++++++--- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 95a6c1e7174..efdc0b80d13 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,11 @@ +2012-09-07 Matt McClure (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 * window.el (switch-to-buffer): Doc fix (Bug#12181). diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 601850ed0fb..ffc6c1ac885 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -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 -- 2.39.2