From eed0bb91900aba4235aca59219ed88e0561f7fb1 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Wed, 6 Jun 2012 15:05:11 +0200 Subject: [PATCH] * progmodes/python.el (python-send-region): Ensure, that the temporary file is created also in the remote case. --- lisp/ChangeLog | 3 +++ lisp/progmodes/python.el | 11 ++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 343368bc591..124b2bbeff6 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -8,6 +8,9 @@ * files.el (enable-remote-dir-locals): New option. (hack-dir-local-variables): Use it. (Bug#1933, Bug#6731) + * progmodes/python.el (python-send-region): Ensure, that the + temporary file is created also in the remote case. + 2012-06-06 Glenn Morris * vc/vc-rcs.el (vc-rcs-rcs2log-program): New. diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 620ea8cd519..8595ac581c0 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -1601,13 +1601,18 @@ behavior, change `python-remove-cwd-from-path' to nil." ;; Fixme: Write a `coding' header to the temp file if the region is ;; non-ASCII. (interactive "r") - (let* ((f (make-temp-file "py" nil ".py")) + (let* ((temporary-file-directory + (if (file-remote-p default-directory) + (concat (file-remote-p default-directory) "/tmp") + temporary-file-directory)) + (f (make-temp-file "py" nil ".py")) + (f-local (or (file-remote-p f 'localname) f)) (command ;; IPython puts the FakeModule module into __main__ so ;; emacs.eexecfile becomes useless. (if (string-match "^ipython" python-command) - (format "execfile %S" f) - (format "emacs.eexecfile(%S)" f))) + (format "execfile %S" f-local) + (format "emacs.eexecfile(%S)" f-local))) (orig-start (copy-marker start))) (when (save-excursion (goto-char start) -- 2.39.2