From: Michael Albinus Date: Wed, 6 Jun 2012 13:32:36 +0000 (+0200) Subject: * net/tramp-compat.el (tramp-compat-temporary-file-directory): X-Git-Tag: emacs-24.2.90~1199^2~474^2~112 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=0372ee92957b11cad804c65bd217d995a0f935bc;p=emacs.git * net/tramp-compat.el (tramp-compat-temporary-file-directory): Ensure, that the temp directory is local. * net/tramp-sh.el (tramp-sh-handle-write-region): Let-bind `temporary-file-directory'. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 124b2bbeff6..0911da1a03b 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -8,6 +8,12 @@ * files.el (enable-remote-dir-locals): New option. (hack-dir-local-variables): Use it. (Bug#1933, Bug#6731) + * net/tramp-compat.el (tramp-compat-temporary-file-directory): + Ensure, that the temp directory is local. + + * net/tramp-sh.el (tramp-sh-handle-write-region): Let-bind + `temporary-file-directory'. + * progmodes/python.el (python-send-region): Ensure, that the temporary file is created also in the remote case. diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el index 2aea87e66ed..3a7926980f6 100644 --- a/lisp/net/tramp-compat.el +++ b/lisp/net/tramp-compat.el @@ -205,7 +205,9 @@ For Emacs, this is the variable `temporary-file-directory', for XEmacs this is the function `temp-directory'." (cond - ((boundp 'temporary-file-directory) (symbol-value 'temporary-file-directory)) + ((and (boundp 'temporary-file-directory) + (not (file-remote-p (symbol-value 'temporary-file-directory)))) + (symbol-value 'temporary-file-directory)) ((fboundp 'temp-directory) (tramp-compat-funcall 'temp-directory)) ((let ((d (getenv "TEMP"))) (and d (file-directory-p d))) (file-name-as-directory (getenv "TEMP"))) diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index b3a5341b3a6..9ccf1d8e3e2 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -3093,22 +3093,25 @@ Returns a file name in `tramp-auto-save-directory' for autosaving this file." 'write-region (list start end localname append 'no-message lockname confirm)) - (let ((modes (save-excursion (tramp-default-file-modes filename))) - ;; We use this to save the value of - ;; `last-coding-system-used' after writing the tmp - ;; file. At the end of the function, we set - ;; `last-coding-system-used' to this saved value. This - ;; way, any intermediary coding systems used while - ;; talking to the remote shell or suchlike won't hose - ;; this variable. This approach was snarfed from - ;; ange-ftp.el. - coding-system-used - ;; Write region into a tmp file. This isn't really - ;; needed if we use an encoding function, but currently - ;; we use it always because this makes the logic - ;; simpler. - (tmpfile (or tramp-temp-buffer-file-name - (tramp-compat-make-temp-file filename)))) + (let* ((modes (save-excursion (tramp-default-file-modes filename))) + ;; We use this to save the value of + ;; `last-coding-system-used' after writing the tmp + ;; file. At the end of the function, we set + ;; `last-coding-system-used' to this saved value. This + ;; way, any intermediary coding systems used while + ;; talking to the remote shell or suchlike won't hose + ;; this variable. This approach was snarfed from + ;; ange-ftp.el. + coding-system-used + ;; Write region into a tmp file. This isn't really + ;; needed if we use an encoding function, but currently + ;; we use it always because this makes the logic + ;; simpler. We must also set `temporary-file-directory', + ;; because it could point to a remote directory. + (temporary-file-directory + (tramp-compat-temporary-file-directory)) + (tmpfile (or tramp-temp-buffer-file-name + (tramp-compat-make-temp-file filename)))) ;; If `append' is non-nil, we copy the file locally, and let ;; the native `write-region' implementation do the job.