summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Albinus <michael.albinus@gmx.de>2014-11-04 10:02:56 +0100
committerMichael Albinus <michael.albinus@gmx.de>2014-11-04 10:02:56 +0100
commitb6ad705482c2b6e42e9d38f427765fc56319567e (patch)
treebbb90dca4a29c94eb8abd884d856ac65adb6da63
parent46fc78f57e9be79e144303066b9164b000af76fa (diff)
downloademacs-b6ad705482c2b6e42e9d38f427765fc56319567e.tar.gz
* net/tramp-sh.el (tramp-do-copy-or-rename-file-via-buffer): Don't use
a local copy; setting `inhibit-file-name-handlers' proper might be more performant. Fixes: debbugs:18751
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/net/tramp-sh.el13
2 files changed, 13 insertions, 6 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index d0d61da52f4..12a140d445d 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
+2014-11-04 Michael Albinus <michael.albinus@gmx.de>
+
+ * net/tramp-sh.el (tramp-do-copy-or-rename-file-via-buffer): Don't use
+ a local copy; setting `inhibit-file-name-handlers' proper might be
+ more performant. (Bug#18751)
+
2014-11-04 Glenn Morris <rgm@gnu.org>
* mail/emacsbug.el (report-emacs-bug): No longer include
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index a72a79a7797..3103eb0daa2 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -2061,15 +2061,16 @@ FILENAME is the source file, NEWNAME the target file.
KEEP-DATE is non-nil if NEWNAME should have the same timestamp as FILENAME."
(with-temp-buffer
;; We must disable multibyte, because binary data shall not be
- ;; converted. `insert-file-contents-literally' does not support
- ;; file name handlers for GNU Emacs; we must create a local copy
- ;; therefore.
+ ;; converted. We remove `tramp-file-name-handler' from
+ ;; `inhibit-file-name-handlers'; otherwise the file name handler
+ ;; for `insert-file-contents' might be deactivated in some corner
+ ;; cases.
(set-buffer-multibyte nil)
(let ((coding-system-for-read 'binary)
(jka-compr-inhibit t)
- (tmpfile (file-local-copy filename)))
- (insert-file-contents-literally (or tmpfile filename))
- (when tmpfile (delete-file tmpfile)))
+ (inhibit-file-name-handlers
+ (remq 'tramp-file-name-handler inhibit-file-name-handlers)))
+ (insert-file-contents-literally filename))
;; We don't want the target file to be compressed, so we let-bind
;; `jka-compr-inhibit' to t.
(let ((coding-system-for-write 'binary)