diff options
| -rw-r--r-- | lisp/ChangeLog | 14 | ||||
| -rw-r--r-- | lisp/net/tramp.el | 91 |
2 files changed, 87 insertions, 18 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 93541e4f31e..a857a68cb93 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,17 @@ | |||
| 1 | 2009-10-23 Michael Albinus <michael.albinus@gmx.de> | ||
| 2 | |||
| 3 | * net/tramp.el (top): Remove `tramp-rfn-eshadow-update-overlay' | ||
| 4 | from `rfn-eshadow-update-overlay-hook' when unloading. | ||
| 5 | (tramp-methods): Add `tramp-copy-keep-tmpfile' for "rsync" and | ||
| 6 | "rsyncc". Adjust doc string. | ||
| 7 | (tramp-temp-buffer-file-name) New buffer-local defvar. | ||
| 8 | (tramp-handle-insert-file-contents, tramp-handle-write-region): | ||
| 9 | Keep temporary file when indicated by method ("rsync" and | ||
| 10 | "rsyncc"). | ||
| 11 | (tramp-handle-write-region): Handle APPEND. | ||
| 12 | (tramp-delete-temp-file-function): New defun. Added to | ||
| 13 | `kill-buffer-hook'. | ||
| 14 | |||
| 1 | 2009-10-23 Juanma Barranquero <lekktu@gmail.com> | 15 | 2009-10-23 Juanma Barranquero <lekktu@gmail.com> |
| 2 | 16 | ||
| 3 | * menu-bar.el (cua-enable-cua-keys): Declare for the byte-compiler. | 17 | * menu-bar.el (cua-enable-cua-keys): Declare for the byte-compiler. |
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index e7ca0143cc6..bd1e7f46d9d 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el | |||
| @@ -386,6 +386,7 @@ files conditionalize this setup based on the TERM environment variable." | |||
| 386 | (tramp-copy-program "rsync") | 386 | (tramp-copy-program "rsync") |
| 387 | (tramp-copy-args (("-e" "ssh") ("-t" "%k") ("-r"))) | 387 | (tramp-copy-args (("-e" "ssh") ("-t" "%k") ("-r"))) |
| 388 | (tramp-copy-keep-date t) | 388 | (tramp-copy-keep-date t) |
| 389 | (tramp-copy-keep-tmpfile t) | ||
| 389 | (tramp-copy-recursive t) | 390 | (tramp-copy-recursive t) |
| 390 | (tramp-password-end-of-line nil)) | 391 | (tramp-password-end-of-line nil)) |
| 391 | ("rsyncc" | 392 | ("rsyncc" |
| @@ -403,6 +404,7 @@ files conditionalize this setup based on the TERM environment variable." | |||
| 403 | " -o ControlPath=%t.%%r@%%h:%%p" | 404 | " -o ControlPath=%t.%%r@%%h:%%p" |
| 404 | " -o ControlMaster=auto")))) | 405 | " -o ControlMaster=auto")))) |
| 405 | (tramp-copy-keep-date t) | 406 | (tramp-copy-keep-date t) |
| 407 | (tramp-copy-keep-tmpfile t) | ||
| 406 | (tramp-copy-recursive t) | 408 | (tramp-copy-recursive t) |
| 407 | (tramp-password-end-of-line nil)) | 409 | (tramp-password-end-of-line nil)) |
| 408 | ("remcp" (tramp-login-program "remsh") | 410 | ("remcp" (tramp-login-program "remsh") |
| @@ -654,6 +656,11 @@ pair of the form (KEY VALUE). The following KEYs are defined: | |||
| 654 | * `tramp-copy-keep-date' | 656 | * `tramp-copy-keep-date' |
| 655 | This specifies whether the copying program when the preserves the | 657 | This specifies whether the copying program when the preserves the |
| 656 | timestamp of the original file. | 658 | timestamp of the original file. |
| 659 | * `tramp-copy-keep-tmpfile' | ||
| 660 | This specifies whether a temporary local file shall be kept | ||
| 661 | for optimization reasons (useful for \"rsync\" methods). | ||
| 662 | * `tramp-copy-recursive' | ||
| 663 | Whether the operation copies directories recursively. | ||
| 657 | * `tramp-default-port' | 664 | * `tramp-default-port' |
| 658 | The default port of a method is needed in case of gateway connections. | 665 | The default port of a method is needed in case of gateway connections. |
| 659 | Additionally, it is used as indication which method is prepared for | 666 | Additionally, it is used as indication which method is prepared for |
| @@ -1146,6 +1153,11 @@ part, though." | |||
| 1146 | "Buffer name for a temporary buffer. | 1153 | "Buffer name for a temporary buffer. |
| 1147 | It shall be used in combination with `generate-new-buffer-name'.") | 1154 | It shall be used in combination with `generate-new-buffer-name'.") |
| 1148 | 1155 | ||
| 1156 | (defvar tramp-temp-buffer-file-name nil | ||
| 1157 | "File name of a persistent local temporary file. | ||
| 1158 | Useful for \"rsync\" like methods.") | ||
| 1159 | (make-variable-buffer-local 'tramp-temp-buffer-file-name) | ||
| 1160 | |||
| 1149 | (defcustom tramp-sh-extra-args '(("/bash\\'" . "-norc -noprofile")) | 1161 | (defcustom tramp-sh-extra-args '(("/bash\\'" . "-norc -noprofile")) |
| 1150 | "*Alist specifying extra arguments to pass to the remote shell. | 1162 | "*Alist specifying extra arguments to pass to the remote shell. |
| 1151 | Entries are (REGEXP . ARGS) where REGEXP is a regular expression | 1163 | Entries are (REGEXP . ARGS) where REGEXP is a regular expression |
| @@ -1942,7 +1954,7 @@ normal Emacs functions.") | |||
| 1942 | ;; Handlers for foreign methods, like FTP or SMB, shall be plugged here. | 1954 | ;; Handlers for foreign methods, like FTP or SMB, shall be plugged here. |
| 1943 | (defvar tramp-foreign-file-name-handler-alist | 1955 | (defvar tramp-foreign-file-name-handler-alist |
| 1944 | ;; (identity . tramp-sh-file-name-handler) should always be the last | 1956 | ;; (identity . tramp-sh-file-name-handler) should always be the last |
| 1945 | ;; entry, since `identity' always matches. | 1957 | ;; entry, because `identity' always matches. |
| 1946 | '((identity . tramp-sh-file-name-handler)) | 1958 | '((identity . tramp-sh-file-name-handler)) |
| 1947 | "Alist of elements (FUNCTION . HANDLER) for foreign methods handled specially. | 1959 | "Alist of elements (FUNCTION . HANDLER) for foreign methods handled specially. |
| 1948 | If (FUNCTION FILENAME) returns non-nil, then all I/O on that file is done by | 1960 | If (FUNCTION FILENAME) returns non-nil, then all I/O on that file is done by |
| @@ -2295,7 +2307,11 @@ been set up by `rfn-eshadow-setup-minibuffer'." | |||
| 2295 | 2307 | ||
| 2296 | (when (boundp 'rfn-eshadow-update-overlay-hook) | 2308 | (when (boundp 'rfn-eshadow-update-overlay-hook) |
| 2297 | (add-hook 'rfn-eshadow-update-overlay-hook | 2309 | (add-hook 'rfn-eshadow-update-overlay-hook |
| 2298 | 'tramp-rfn-eshadow-update-overlay)) | 2310 | 'tramp-rfn-eshadow-update-overlay) |
| 2311 | (add-hook 'tramp-unload-hook | ||
| 2312 | (lambda () | ||
| 2313 | (remove-hook 'rfn-eshadow-update-overlay-hook | ||
| 2314 | 'tramp-rfn-eshadow-update-overlay)))) | ||
| 2299 | 2315 | ||
| 2300 | 2316 | ||
| 2301 | ;;; File Name Handler Functions: | 2317 | ;;; File Name Handler Functions: |
| @@ -4431,11 +4447,25 @@ coding system might not be determined. This function repairs it." | |||
| 4431 | (when (eq inhibit-file-name-operation | 4447 | (when (eq inhibit-file-name-operation |
| 4432 | 'insert-file-contents) | 4448 | 'insert-file-contents) |
| 4433 | 'file-local-copy))) | 4449 | 'file-local-copy))) |
| 4434 | (file-local-copy | 4450 | (cond |
| 4435 | (if (stringp remote-copy) | 4451 | ((stringp remote-copy) |
| 4436 | (tramp-make-tramp-file-name | 4452 | (file-local-copy |
| 4437 | method user host remote-copy) | 4453 | (tramp-make-tramp-file-name |
| 4438 | filename)))) | 4454 | method user host remote-copy))) |
| 4455 | ((stringp tramp-temp-buffer-file-name) | ||
| 4456 | (copy-file filename tramp-temp-buffer-file-name 'ok) | ||
| 4457 | tramp-temp-buffer-file-name) | ||
| 4458 | (t (file-local-copy filename))))) | ||
| 4459 | |||
| 4460 | (when (and (null remote-copy) | ||
| 4461 | (tramp-get-method-parameter | ||
| 4462 | method 'tramp-copy-keep-tmpfile)) | ||
| 4463 | ;; We keep the local file for performance reasons, | ||
| 4464 | ;; useful for "rsync". | ||
| 4465 | (set-file-modes local-copy (tramp-octal-to-decimal "0600")) | ||
| 4466 | (setq tramp-temp-buffer-file-name local-copy) | ||
| 4467 | (put 'tramp-temp-buffer-file-name 'permanent-local t)) | ||
| 4468 | |||
| 4439 | (tramp-message | 4469 | (tramp-message |
| 4440 | v 4 "Inserting local temp file `%s'..." local-copy) | 4470 | v 4 "Inserting local temp file `%s'..." local-copy) |
| 4441 | 4471 | ||
| @@ -4465,7 +4495,8 @@ coding system might not be determined. This function repairs it." | |||
| 4465 | (setq buffer-read-only (not (file-writable-p filename))) | 4495 | (setq buffer-read-only (not (file-writable-p filename))) |
| 4466 | (set-visited-file-modtime) | 4496 | (set-visited-file-modtime) |
| 4467 | (set-buffer-modified-p nil)) | 4497 | (set-buffer-modified-p nil)) |
| 4468 | (when (stringp local-copy) | 4498 | (when (and (stringp local-copy) |
| 4499 | (or remote-copy (null tramp-temp-buffer-file-name))) | ||
| 4469 | (delete-file local-copy)) | 4500 | (delete-file local-copy)) |
| 4470 | (when (stringp remote-copy) | 4501 | (when (stringp remote-copy) |
| 4471 | (delete-file | 4502 | (delete-file |
| @@ -4585,15 +4616,12 @@ Returns a file name in `tramp-auto-save-directory' for autosaving this file." | |||
| 4585 | (defvar tramp-handle-write-region-hook nil | 4616 | (defvar tramp-handle-write-region-hook nil |
| 4586 | "Normal hook to be run at the end of `tramp-handle-write-region'.") | 4617 | "Normal hook to be run at the end of `tramp-handle-write-region'.") |
| 4587 | 4618 | ||
| 4588 | ;; CCC grok APPEND, LOCKNAME | 4619 | ;; CCC grok LOCKNAME |
| 4589 | (defun tramp-handle-write-region | 4620 | (defun tramp-handle-write-region |
| 4590 | (start end filename &optional append visit lockname confirm) | 4621 | (start end filename &optional append visit lockname confirm) |
| 4591 | "Like `write-region' for Tramp files." | 4622 | "Like `write-region' for Tramp files." |
| 4592 | (setq filename (expand-file-name filename)) | 4623 | (setq filename (expand-file-name filename)) |
| 4593 | (with-parsed-tramp-file-name filename nil | 4624 | (with-parsed-tramp-file-name filename nil |
| 4594 | (unless (null append) | ||
| 4595 | (tramp-error | ||
| 4596 | v 'file-error "Cannot append to file using Tramp (`%s')" filename)) | ||
| 4597 | ;; Following part commented out because we don't know what to do about | 4625 | ;; Following part commented out because we don't know what to do about |
| 4598 | ;; file locking, and it does not appear to be a problem to ignore it. | 4626 | ;; file locking, and it does not appear to be a problem to ignore it. |
| 4599 | ;; Ange-ftp ignores it, too. | 4627 | ;; Ange-ftp ignores it, too. |
| @@ -4644,8 +4672,13 @@ Returns a file name in `tramp-auto-save-directory' for autosaving this file." | |||
| 4644 | ;; Write region into a tmp file. This isn't really | 4672 | ;; Write region into a tmp file. This isn't really |
| 4645 | ;; needed if we use an encoding function, but currently | 4673 | ;; needed if we use an encoding function, but currently |
| 4646 | ;; we use it always because this makes the logic | 4674 | ;; we use it always because this makes the logic |
| 4647 | ;; simpler. | 4675 | ;; simpler. If `append' is non-nil, we copy the file |
| 4648 | (tmpfile (tramp-compat-make-temp-file filename))) | 4676 | ;; locally, and let the native `write-region' |
| 4677 | ;; implementation do the job. | ||
| 4678 | (tmpfile (if append | ||
| 4679 | (file-local-copy filename) | ||
| 4680 | (or tramp-temp-buffer-file-name | ||
| 4681 | (tramp-compat-make-temp-file filename))))) | ||
| 4649 | 4682 | ||
| 4650 | ;; We say `no-message' here because we don't want the | 4683 | ;; We say `no-message' here because we don't want the |
| 4651 | ;; visited file modtime data to be clobbered from the temp | 4684 | ;; visited file modtime data to be clobbered from the temp |
| @@ -4659,6 +4692,7 @@ Returns a file name in `tramp-auto-save-directory' for autosaving this file." | |||
| 4659 | 'write-region | 4692 | 'write-region |
| 4660 | (list start end tmpfile append 'no-message lockname confirm)) | 4693 | (list start end tmpfile append 'no-message lockname confirm)) |
| 4661 | ((error quit) | 4694 | ((error quit) |
| 4695 | (setq tramp-temp-buffer-file-name nil) | ||
| 4662 | (delete-file tmpfile) | 4696 | (delete-file tmpfile) |
| 4663 | (signal (car err) (cdr err)))) | 4697 | (signal (car err) (cdr err)))) |
| 4664 | 4698 | ||
| @@ -4686,8 +4720,19 @@ Returns a file name in `tramp-auto-save-directory' for autosaving this file." | |||
| 4686 | (tramp-method-out-of-band-p | 4720 | (tramp-method-out-of-band-p |
| 4687 | v (- (or end (point-max)) (or start (point-min))))) | 4721 | v (- (or end (point-max)) (or start (point-min))))) |
| 4688 | (condition-case err | 4722 | (condition-case err |
| 4689 | (rename-file tmpfile filename t) | 4723 | (if (and (= (or end (point-max)) (point-max)) |
| 4724 | (= (or start (point-min)) (point-min)) | ||
| 4725 | (tramp-get-method-parameter | ||
| 4726 | method 'tramp-copy-keep-tmpfile)) | ||
| 4727 | (progn | ||
| 4728 | ;; We keep the local file for performance | ||
| 4729 | ;; reasons, useful for "rsync". | ||
| 4730 | (setq tramp-temp-buffer-file-name tmpfile) | ||
| 4731 | (copy-file tmpfile filename t)) | ||
| 4732 | (setq tramp-temp-buffer-file-name nil) | ||
| 4733 | (rename-file tmpfile filename t)) | ||
| 4690 | ((error quit) | 4734 | ((error quit) |
| 4735 | (setq tramp-temp-buffer-file-name nil) | ||
| 4691 | (delete-file tmpfile) | 4736 | (delete-file tmpfile) |
| 4692 | (signal (car err) (cdr err))))) | 4737 | (signal (car err) (cdr err))))) |
| 4693 | 4738 | ||
| @@ -5816,6 +5861,19 @@ hosts, or files, disagree." | |||
| 5816 | (format "*tramp/%s %s@%s*" method user host) | 5861 | (format "*tramp/%s %s@%s*" method user host) |
| 5817 | (format "*tramp/%s %s*" method host)))) | 5862 | (format "*tramp/%s %s*" method host)))) |
| 5818 | 5863 | ||
| 5864 | (defun tramp-delete-temp-file-function () | ||
| 5865 | "Remove temporary files related to current buffer." | ||
| 5866 | (when (stringp tramp-temp-buffer-file-name) | ||
| 5867 | (condition-case nil | ||
| 5868 | (delete-file tramp-temp-buffer-file-name) | ||
| 5869 | (error nil)))) | ||
| 5870 | |||
| 5871 | (add-hook 'kill-buffer-hook 'tramp-delete-temp-file-function) | ||
| 5872 | (add-hook 'tramp-cache-unload-hook | ||
| 5873 | (lambda () | ||
| 5874 | (remove-hook 'kill-buffer-hook | ||
| 5875 | 'tramp-delete-temp-file-function))) | ||
| 5876 | |||
| 5819 | (defun tramp-get-buffer (vec) | 5877 | (defun tramp-get-buffer (vec) |
| 5820 | "Get the connection buffer to be used for VEC." | 5878 | "Get the connection buffer to be used for VEC." |
| 5821 | (or (get-buffer (tramp-buffer-name vec)) | 5879 | (or (get-buffer (tramp-buffer-name vec)) |
| @@ -8069,14 +8127,11 @@ Only works for Bourne-like shells." | |||
| 8069 | ;; * `vc-directory' does not work. It never displays any files, even | 8127 | ;; * `vc-directory' does not work. It never displays any files, even |
| 8070 | ;; if it does show files when run locally. | 8128 | ;; if it does show files when run locally. |
| 8071 | ;; * How to deal with MULE in `insert-file-contents' and `write-region'? | 8129 | ;; * How to deal with MULE in `insert-file-contents' and `write-region'? |
| 8072 | ;; * Grok `append' parameter for `write-region'. | ||
| 8073 | ;; * Test remote ksh or bash for tilde expansion in `tramp-find-shell'? | 8130 | ;; * Test remote ksh or bash for tilde expansion in `tramp-find-shell'? |
| 8074 | ;; * abbreviate-file-name | 8131 | ;; * abbreviate-file-name |
| 8075 | ;; * Better error checking. At least whenever we see something | 8132 | ;; * Better error checking. At least whenever we see something |
| 8076 | ;; strange when doing zerop, we should kill the process and start | 8133 | ;; strange when doing zerop, we should kill the process and start |
| 8077 | ;; again. (Greg Stark) | 8134 | ;; again. (Greg Stark) |
| 8078 | ;; * Provide a local cache of old versions of remote files for the rsync | ||
| 8079 | ;; transfer method to use. (Greg Stark) | ||
| 8080 | ;; * Remove unneeded parameters from methods. | 8135 | ;; * Remove unneeded parameters from methods. |
| 8081 | ;; * Make it work for different encodings, and for different file name | 8136 | ;; * Make it work for different encodings, and for different file name |
| 8082 | ;; encodings, too. (Daniel Pittman) | 8137 | ;; encodings, too. (Daniel Pittman) |