1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-01-05 11:45:45 +00:00

* 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'.
This commit is contained in:
Michael Albinus 2012-06-06 15:32:36 +02:00
parent eed0bb9190
commit 0372ee9295
3 changed files with 28 additions and 17 deletions

View File

@ -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.

View File

@ -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")))

View File

@ -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.