Commit 0372ee92 authored by Michael Albinus's avatar Michael Albinus
Browse files

* 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'.
parent eed0bb91
......@@ -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.
 
......
......@@ -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")))
......
......@@ -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.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment