diff options
| author | Michael Albinus | 2007-10-03 10:54:03 +0000 |
|---|---|---|
| committer | Michael Albinus | 2007-10-03 10:54:03 +0000 |
| commit | 94be87e8b7d72e300ff8273fa117672ea09ed08a (patch) | |
| tree | 787464f30fc7b8ea310d645b238a7bb63628aee0 | |
| parent | e330de44833fd8061df4506a5c8dae76d23d897e (diff) | |
| download | emacs-94be87e8b7d72e300ff8273fa117672ea09ed08a.tar.gz emacs-94be87e8b7d72e300ff8273fa117672ea09ed08a.zip | |
* net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
(tramp-file-name-handler-alist): Add
`tramp-handle-insert-file-contents-literally'. Neded for XEmacs.
(tramp-make-temp-file): Use `make-temp-name'. `make-temp-file',
used before, creates the file already, which is not desired.
(tramp-do-copy-or-rename-file-directly): Simplify handling of
temporary file.
(tramp-handle-insert-file-contents): Assign the result in the
short track case.
(tramp-handle-insert-file-contents-literally): New defun.
(tramp-completion-mode-p): Revert change from 2007-09-24.
Checking for `return' etc as last character is not sufficient, for
example in dired-mode when entering <g> (revert-buffer) or
<s> (dired-sort).
* net/tramp-compat.el (top): Add also compatibility code for loading
appropriate timer package.
(tramp-compat-copy-tree): Check for `subrp' and `symbol-file' in
order to avoid autoloading problems.
* net/tramp-fish.el:
* net/tramp-smb.el: Move further compatibility code to
tramp-compat.el.
* net/tramp-ftp.el (tramp-ftp-file-name-handler): Handle the case
where the second parameter of `copy-file' or `rename-file' is a
remote file but not via ftp.
| -rw-r--r-- | lisp/ChangeLog | 30 | ||||
| -rw-r--r-- | lisp/net/tramp-compat.el | 110 | ||||
| -rw-r--r-- | lisp/net/tramp-fish.el | 34 | ||||
| -rw-r--r-- | lisp/net/tramp-ftp.el | 13 | ||||
| -rw-r--r-- | lisp/net/tramp-smb.el | 33 | ||||
| -rw-r--r-- | lisp/net/tramp.el | 140 |
6 files changed, 207 insertions, 153 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index b678d5d8eec..fa2826b4ed7 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,33 @@ | |||
| 1 | 2007-10-03 Michael Albinus <michael.albinus@gmx.de> | ||
| 2 | |||
| 3 | * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'. | ||
| 4 | (tramp-file-name-handler-alist): Add | ||
| 5 | `tramp-handle-insert-file-contents-literally'. Neded for XEmacs. | ||
| 6 | (tramp-make-temp-file): Use `make-temp-name'. `make-temp-file', | ||
| 7 | used before, creates the file already, which is not desired. | ||
| 8 | (tramp-do-copy-or-rename-file-directly): Simplify handling of | ||
| 9 | temporary file. | ||
| 10 | (tramp-handle-insert-file-contents): Assign the result in the | ||
| 11 | short track case. | ||
| 12 | (tramp-handle-insert-file-contents-literally): New defun. | ||
| 13 | (tramp-completion-mode-p): Revert change from 2007-09-24. | ||
| 14 | Checking for `return' etc as last character is not sufficient, for | ||
| 15 | example in dired-mode when entering <g> (revert-buffer) or | ||
| 16 | <s> (dired-sort). | ||
| 17 | |||
| 18 | * net/tramp-compat.el (top): Add also compatibility code for loading | ||
| 19 | appropriate timer package. | ||
| 20 | (tramp-compat-copy-tree): Check for `subrp' and `symbol-file' in | ||
| 21 | order to avoid autoloading problems. | ||
| 22 | |||
| 23 | * net/tramp-fish.el: | ||
| 24 | * net/tramp-smb.el: Move further compatibility code to | ||
| 25 | tramp-compat.el. | ||
| 26 | |||
| 27 | * net/tramp-ftp.el (tramp-ftp-file-name-handler): Handle the case | ||
| 28 | where the second parameter of `copy-file' or `rename-file' is a | ||
| 29 | remote file but not via ftp. | ||
| 30 | |||
| 1 | 2007-10-02 Richard Stallman <rms@gnu.org> | 31 | 2007-10-02 Richard Stallman <rms@gnu.org> |
| 2 | 32 | ||
| 3 | * frame.el (cursor-in-non-selected-windows): Doc fix. | 33 | * frame.el (cursor-in-non-selected-windows): Doc fix. |
diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el index 8d041b2faf3..620384eaf38 100644 --- a/lisp/net/tramp-compat.el +++ b/lisp/net/tramp-compat.el | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | ;;; tramp-gw.el --- Tramp compatibility functions | 1 | ;;; tramp-compat.el --- Tramp compatibility functions |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 2007 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 2007 Free Software Foundation, Inc. |
| 4 | 4 | ||
| @@ -29,45 +29,66 @@ | |||
| 29 | 29 | ||
| 30 | ;;; Code: | 30 | ;;; Code: |
| 31 | 31 | ||
| 32 | ;; Pacify byte-compiler | 32 | (eval-and-compile |
| 33 | (eval-when-compile | 33 | |
| 34 | ;; Pacify byte-compiler. | ||
| 34 | (require 'cl) | 35 | (require 'cl) |
| 35 | (require 'custom)) | 36 | (require 'custom) |
| 36 | 37 | ||
| 37 | ;; Avoid byte-compiler warnings if the byte-compiler supports this. | 38 | ;; Load the appropriate timer package. |
| 38 | ;; Currently, XEmacs supports this. | 39 | (if (featurep 'xemacs) |
| 39 | ;(eval-when-compile | 40 | (require 'timer-funcs) |
| 40 | ; (when (featurep 'xemacs) | 41 | (require 'timer)) |
| 41 | ; (byte-compiler-options (warnings (- unused-vars))))) | ||
| 42 | 42 | ||
| 43 | ;; `last-coding-system-used' is unknown in XEmacs. | 43 | ;; Avoid byte-compiler warnings if the byte-compiler supports this. |
| 44 | (eval-when-compile | 44 | ;; Currently, XEmacs supports this. |
| 45 | (when (featurep 'xemacs) | ||
| 46 | (unless (boundp 'byte-compile-default-warnings) | ||
| 47 | (defvar byte-compile-default-warnings nil)) | ||
| 48 | (delq 'unused-vars byte-compile-default-warnings)) | ||
| 49 | |||
| 50 | ;; `last-coding-system-used' is unknown in XEmacs. | ||
| 45 | (unless (boundp 'last-coding-system-used) | 51 | (unless (boundp 'last-coding-system-used) |
| 46 | (defvar last-coding-system-used nil))) | 52 | (defvar last-coding-system-used nil)) |
| 47 | 53 | ||
| 48 | ;; `directory-sep-char' is an obsolete variable in Emacs. But it is | 54 | ;; `directory-sep-char' is an obsolete variable in Emacs. But it is |
| 49 | ;; used in XEmacs, so we set it here and there. The following is needed | 55 | ;; used in XEmacs, so we set it here and there. The following is |
| 50 | ;; to pacify Emacs byte-compiler. | 56 | ;; needed to pacify Emacs byte-compiler. |
| 51 | (eval-when-compile | ||
| 52 | (unless (boundp 'byte-compile-not-obsolete-var) | 57 | (unless (boundp 'byte-compile-not-obsolete-var) |
| 53 | (defvar byte-compile-not-obsolete-var nil)) | 58 | (defvar byte-compile-not-obsolete-var nil)) |
| 54 | (setq byte-compile-not-obsolete-var 'directory-sep-char)) | 59 | (setq byte-compile-not-obsolete-var 'directory-sep-char) |
| 55 | 60 | ||
| 56 | ;; `with-temp-message' does not exists in XEmacs. | 61 | ;; `with-temp-message' does not exists in XEmacs. |
| 57 | (eval-and-compile | ||
| 58 | (condition-case nil | 62 | (condition-case nil |
| 59 | (with-temp-message (current-message) nil) | 63 | (with-temp-message (current-message) nil) |
| 60 | (error (defmacro with-temp-message (message &rest body) `(progn ,@body))))) | 64 | (error (defmacro with-temp-message (message &rest body) `(progn ,@body)))) |
| 61 | 65 | ||
| 62 | ;; `set-buffer-multibyte' comes from Emacs Leim. | 66 | ;; `set-buffer-multibyte' comes from Emacs Leim. |
| 63 | (eval-and-compile | ||
| 64 | (unless (fboundp 'set-buffer-multibyte) | 67 | (unless (fboundp 'set-buffer-multibyte) |
| 65 | (defalias 'set-buffer-multibyte 'ignore))) | 68 | (defalias 'set-buffer-multibyte 'ignore)) |
| 66 | 69 | ||
| 67 | ;; `font-lock-add-keywords' does not exist in XEmacs. | 70 | ;; `font-lock-add-keywords' does not exist in XEmacs. |
| 68 | (eval-and-compile | ||
| 69 | (unless (fboundp 'font-lock-add-keywords) | 71 | (unless (fboundp 'font-lock-add-keywords) |
| 70 | (defalias 'font-lock-add-keywords 'ignore))) | 72 | (defalias 'font-lock-add-keywords 'ignore)) |
| 73 | |||
| 74 | ;; `file-remote-p' has been introduced with Emacs 22. The version | ||
| 75 | ;; of XEmacs is not a magic file name function (yet); this is | ||
| 76 | ;; corrected in tramp-util.el. Here it is sufficient if the | ||
| 77 | ;; function exists. | ||
| 78 | (unless (fboundp 'file-remote-p) | ||
| 79 | (defalias 'file-remote-p 'tramp-handle-file-remote-p)) | ||
| 80 | |||
| 81 | ;; `process-file' exists since Emacs 22. | ||
| 82 | (unless (fboundp 'process-file) | ||
| 83 | (defalias 'process-file 'tramp-handle-process-file)) | ||
| 84 | |||
| 85 | ;; `start-file-process' is new in Emacs 23. | ||
| 86 | (unless (fboundp 'start-file-process) | ||
| 87 | (defalias 'start-file-process 'tramp-handle-start-file-process)) | ||
| 88 | |||
| 89 | ;; `set-file-times' is also new in Emacs 23. | ||
| 90 | (unless (fboundp 'set-file-times) | ||
| 91 | (defalias 'set-file-times 'tramp-handle-set-file-times))) | ||
| 71 | 92 | ||
| 72 | (defsubst tramp-compat-line-end-position () | 93 | (defsubst tramp-compat-line-end-position () |
| 73 | "Return point at end of line (compat function). | 94 | "Return point at end of line (compat function). |
| @@ -83,10 +104,8 @@ own implementation." | |||
| 83 | For Emacs, this is the variable `temporary-file-directory', for XEmacs | 104 | For Emacs, this is the variable `temporary-file-directory', for XEmacs |
| 84 | this is the function `temp-directory'." | 105 | this is the function `temp-directory'." |
| 85 | (cond | 106 | (cond |
| 86 | ((boundp 'temporary-file-directory) | 107 | ((boundp 'temporary-file-directory) (symbol-value 'temporary-file-directory)) |
| 87 | (symbol-value 'temporary-file-directory)) | 108 | ((fboundp 'temp-directory) (funcall (symbol-function 'temp-directory))) |
| 88 | ((fboundp 'temp-directory) | ||
| 89 | (funcall (symbol-function 'temp-directory))) ;pacify byte-compiler | ||
| 90 | ((let ((d (getenv "TEMP"))) (and d (file-directory-p d))) | 109 | ((let ((d (getenv "TEMP"))) (and d (file-directory-p d))) |
| 91 | (file-name-as-directory (getenv "TEMP"))) | 110 | (file-name-as-directory (getenv "TEMP"))) |
| 92 | ((let ((d (getenv "TMP"))) (and d (file-directory-p d))) | 111 | ((let ((d (getenv "TMP"))) (and d (file-directory-p d))) |
| @@ -98,12 +117,14 @@ this is the function `temp-directory'." | |||
| 98 | "`temp-directory' is defined -- using /tmp.")) | 117 | "`temp-directory' is defined -- using /tmp.")) |
| 99 | (file-name-as-directory "/tmp")))) | 118 | (file-name-as-directory "/tmp")))) |
| 100 | 119 | ||
| 101 | ;; `most-positive-fixnum' arrived in Emacs 22. | 120 | ;; `most-positive-fixnum' arrived in Emacs 22. Before, and in XEmacs, |
| 121 | ;; it is a fixed value. | ||
| 102 | (defsubst tramp-compat-most-positive-fixnum () | 122 | (defsubst tramp-compat-most-positive-fixnum () |
| 103 | "Return largest positive integer value (compat function)." | 123 | "Return largest positive integer value (compat function)." |
| 104 | (cond ((boundp 'most-positive-fixnum) | 124 | (cond |
| 105 | (symbol-value 'most-positive-fixnum)) | 125 | ((boundp 'most-positive-fixnum) (symbol-value 'most-positive-fixnum)) |
| 106 | (t 134217727))) | 126 | ;; Default value in XEmacs and Emacs 21. |
| 127 | (t 134217727))) | ||
| 107 | 128 | ||
| 108 | ;; ID-FORMAT exists since Emacs 22. | 129 | ;; ID-FORMAT exists since Emacs 22. |
| 109 | (defun tramp-compat-file-attributes (filename &optional id-format) | 130 | (defun tramp-compat-file-attributes (filename &optional id-format) |
| @@ -129,11 +150,13 @@ this is the function `temp-directory'." | |||
| 129 | filename newname ok-if-already-exists keep-date preserve-uid-gid) | 150 | filename newname ok-if-already-exists keep-date preserve-uid-gid) |
| 130 | (copy-file filename newname ok-if-already-exists keep-date))) | 151 | (copy-file filename newname ok-if-already-exists keep-date))) |
| 131 | 152 | ||
| 132 | ;; `copy-tree' is introduced with Emacs 22. We've adapted the | 153 | ;; `copy-tree' is a built-in function in XEmacs. In Emacs 21, it is |
| 133 | ;; implementation from Emacs 23. | 154 | ;; an auoloaded function in cl-extra.el. Since Emacs 22, it is part |
| 155 | ;; of subr.el. There are problems when autoloading, therefore we test | ||
| 156 | ;; for for `subrp' and `symbol-file'. Implementation is taken from Emacs23. | ||
| 134 | (defun tramp-compat-copy-tree (tree) | 157 | (defun tramp-compat-copy-tree (tree) |
| 135 | "Make a copy of TREE (compat function)." | 158 | "Make a copy of TREE (compat function)." |
| 136 | (if (functionp 'copy-tree) | 159 | (if (or (subrp 'copy-tree) (symbol-file 'copy-tree)) |
| 137 | (funcall (symbol-function 'copy-tree) tree) | 160 | (funcall (symbol-function 'copy-tree) tree) |
| 138 | (let (result) | 161 | (let (result) |
| 139 | (while (consp tree) | 162 | (while (consp tree) |
| @@ -144,19 +167,6 @@ this is the function `temp-directory'." | |||
| 144 | (setq tree (cdr tree))) | 167 | (setq tree (cdr tree))) |
| 145 | (nconc (nreverse result) tree)))) | 168 | (nconc (nreverse result) tree)))) |
| 146 | 169 | ||
| 147 | (eval-and-compile | ||
| 148 | (unless (fboundp 'file-remote-p) | ||
| 149 | (defalias 'file-remote-p 'tramp-handle-file-remote-p)) | ||
| 150 | |||
| 151 | (unless (fboundp 'process-file) | ||
| 152 | (defalias 'process-file 'tramp-handle-process-file)) | ||
| 153 | |||
| 154 | (unless (fboundp 'start-file-process) | ||
| 155 | (defalias 'start-file-process 'tramp-handle-start-file-process)) | ||
| 156 | |||
| 157 | (unless (fboundp 'set-file-times) | ||
| 158 | (defalias 'set-file-times 'tramp-handle-set-file-times))) | ||
| 159 | |||
| 160 | (provide 'tramp-compat) | 170 | (provide 'tramp-compat) |
| 161 | 171 | ||
| 162 | ;;; TODO: | 172 | ;;; TODO: |
diff --git a/lisp/net/tramp-fish.el b/lisp/net/tramp-fish.el index 89788c5bcb5..8ae6af76d6b 100644 --- a/lisp/net/tramp-fish.el +++ b/lisp/net/tramp-fish.el | |||
| @@ -157,17 +157,6 @@ | |||
| 157 | (require 'tramp-cache) | 157 | (require 'tramp-cache) |
| 158 | (require 'tramp-compat) | 158 | (require 'tramp-compat) |
| 159 | 159 | ||
| 160 | ;; `directory-sep-char' is an obsolete variable in Emacs. But it is | ||
| 161 | ;; used in XEmacs, so we set it here and there. The following is needed | ||
| 162 | ;; to pacify Emacs byte-compiler. | ||
| 163 | (eval-when-compile | ||
| 164 | (setq byte-compile-not-obsolete-var 'directory-sep-char)) | ||
| 165 | |||
| 166 | ;; Pacify byte-compiler | ||
| 167 | (eval-when-compile | ||
| 168 | (require 'cl) | ||
| 169 | (require 'custom)) | ||
| 170 | |||
| 171 | ;; Define FISH method ... | 160 | ;; Define FISH method ... |
| 172 | (defcustom tramp-fish-method "fish" | 161 | (defcustom tramp-fish-method "fish" |
| 173 | "*Method to connect via FISH protocol." | 162 | "*Method to connect via FISH protocol." |
| @@ -486,14 +475,14 @@ pass to the OPERATION." | |||
| 486 | (tramp-error | 475 | (tramp-error |
| 487 | v 'file-error | 476 | v 'file-error |
| 488 | "Cannot make local copy of non-existing file `%s'" filename)) | 477 | "Cannot make local copy of non-existing file `%s'" filename)) |
| 489 | (let ((tmpfil (tramp-make-temp-file filename))) | 478 | (let ((tmpfile (tramp-make-temp-file filename))) |
| 490 | (tramp-message v 4 "Fetching %s to tmp file %s..." filename tmpfil) | 479 | (tramp-message v 4 "Fetching %s to tmp file %s..." filename tmpfile) |
| 491 | (when (tramp-fish-retrieve-data v) | 480 | (when (tramp-fish-retrieve-data v) |
| 492 | ;; Save file | 481 | ;; Save file |
| 493 | (with-current-buffer (tramp-get-buffer v) | 482 | (with-current-buffer (tramp-get-buffer v) |
| 494 | (write-region (point-min) (point-max) tmpfil)) | 483 | (write-region (point-min) (point-max) tmpfile)) |
| 495 | (tramp-message v 4 "Fetching %s to tmp file %s...done" filename tmpfil) | 484 | (tramp-message v 4 "Fetching %s to tmp file %s...done" filename tmpfile) |
| 496 | tmpfil)))) | 485 | tmpfile)))) |
| 497 | 486 | ||
| 498 | ;; This function should return "foo/" for directories and "bar" for | 487 | ;; This function should return "foo/" for directories and "bar" for |
| 499 | ;; files. | 488 | ;; files. |
| @@ -746,7 +735,7 @@ target of the symlink differ." | |||
| 746 | 735 | ||
| 747 | (with-parsed-tramp-file-name default-directory nil | 736 | (with-parsed-tramp-file-name default-directory nil |
| 748 | (let ((temp-name-prefix (tramp-make-tramp-temp-file v)) | 737 | (let ((temp-name-prefix (tramp-make-tramp-temp-file v)) |
| 749 | command input output stderr outbuf tmpfil ret) | 738 | command input output stderr outbuf tmpfile ret) |
| 750 | ;; Compute command. | 739 | ;; Compute command. |
| 751 | (setq command (mapconcat 'tramp-shell-quote-argument | 740 | (setq command (mapconcat 'tramp-shell-quote-argument |
| 752 | (cons program args) " ")) | 741 | (cons program args) " ")) |
| @@ -818,19 +807,20 @@ target of the symlink differ." | |||
| 818 | (tramp-shell-quote-argument command) output)) | 807 | (tramp-shell-quote-argument command) output)) |
| 819 | (error nil)) | 808 | (error nil)) |
| 820 | ;; Check return code. | 809 | ;; Check return code. |
| 821 | (setq tmpfil (file-local-copy | 810 | (setq tmpfile |
| 822 | (tramp-make-tramp-file-name method user host output))) | 811 | (file-local-copy |
| 812 | (tramp-make-tramp-file-name method user host output))) | ||
| 823 | (with-temp-buffer | 813 | (with-temp-buffer |
| 824 | (insert-file-contents tmpfil) | 814 | (insert-file-contents tmpfile) |
| 825 | (goto-char (point-max)) | 815 | (goto-char (point-max)) |
| 826 | (forward-line -1) | 816 | (forward-line -1) |
| 827 | (looking-at "^###RESULT: \\([0-9]+\\)") | 817 | (looking-at "^###RESULT: \\([0-9]+\\)") |
| 828 | (setq ret (string-to-number (match-string 1))) | 818 | (setq ret (string-to-number (match-string 1))) |
| 829 | (delete-region (point) (point-max)) | 819 | (delete-region (point) (point-max)) |
| 830 | (write-region (point-min) (point-max) tmpfil)) | 820 | (write-region (point-min) (point-max) tmpfile)) |
| 831 | ;; We should show the output anyway. | 821 | ;; We should show the output anyway. |
| 832 | (when outbuf | 822 | (when outbuf |
| 833 | (with-current-buffer outbuf (insert-file-contents tmpfil)) | 823 | (with-current-buffer outbuf (insert-file-contents tmpfile)) |
| 834 | (when display (display-buffer outbuf))) | 824 | (when display (display-buffer outbuf))) |
| 835 | ;; Remove output file. | 825 | ;; Remove output file. |
| 836 | (delete-file (tramp-make-tramp-file-name method user host output))) | 826 | (delete-file (tramp-make-tramp-file-name method user host output))) |
diff --git a/lisp/net/tramp-ftp.el b/lisp/net/tramp-ftp.el index 6fe069636f7..cf98ecba7d5 100644 --- a/lisp/net/tramp-ftp.el +++ b/lisp/net/tramp-ftp.el | |||
| @@ -149,6 +149,19 @@ pass to the OPERATION." | |||
| 149 | (with-parsed-tramp-file-name (car args) nil | 149 | (with-parsed-tramp-file-name (car args) nil |
| 150 | (tramp-set-connection-property v "started" t)) | 150 | (tramp-set-connection-property v "started" t)) |
| 151 | nil)) | 151 | nil)) |
| 152 | ;; If the second argument of `copy-file' or `rename-file' is a | ||
| 153 | ;; remote file name but via FTP, ange-ftp doesn't check this. | ||
| 154 | ;; We must copy it locally first, because there is no place in | ||
| 155 | ;; ange-ftp for correct handling. | ||
| 156 | ((and (memq operation '(copy-file rename-file)) | ||
| 157 | (file-remote-p (cadr args)) | ||
| 158 | (not (tramp-ftp-file-name-p (cadr args)))) | ||
| 159 | (let* ((filename (car args)) | ||
| 160 | (newname (cadr args)) | ||
| 161 | (tmpfile (tramp-make-temp-file filename)) | ||
| 162 | (args (cddr args))) | ||
| 163 | (apply operation filename tmpfile args) | ||
| 164 | (rename-file tmpfile newname (car args)))) | ||
| 152 | ;; Normally, the handlers must be discarded. | 165 | ;; Normally, the handlers must be discarded. |
| 153 | (t (let* ((inhibit-file-name-handlers | 166 | (t (let* ((inhibit-file-name-handlers |
| 154 | (list 'tramp-file-name-handler | 167 | (list 'tramp-file-name-handler |
diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el index c9d709ff08a..6cbe4dbd61d 100644 --- a/lisp/net/tramp-smb.el +++ b/lisp/net/tramp-smb.el | |||
| @@ -32,11 +32,6 @@ | |||
| 32 | (require 'tramp-cache) | 32 | (require 'tramp-cache) |
| 33 | (require 'tramp-compat) | 33 | (require 'tramp-compat) |
| 34 | 34 | ||
| 35 | ;; Pacify byte-compiler | ||
| 36 | (eval-when-compile | ||
| 37 | (require 'cl) | ||
| 38 | (require 'custom)) | ||
| 39 | |||
| 40 | ;; Define SMB method ... | 35 | ;; Define SMB method ... |
| 41 | (defcustom tramp-smb-method "smb" | 36 | (defcustom tramp-smb-method "smb" |
| 42 | "*Method to connect SAMBA and M$ SMB servers." | 37 | "*Method to connect SAMBA and M$ SMB servers." |
| @@ -376,19 +371,19 @@ KEEP-DATE is not handled in case NEWNAME resides on an SMB server." | |||
| 376 | "Like `file-local-copy' for Tramp files." | 371 | "Like `file-local-copy' for Tramp files." |
| 377 | (with-parsed-tramp-file-name filename nil | 372 | (with-parsed-tramp-file-name filename nil |
| 378 | (let ((file (tramp-smb-get-localname localname t)) | 373 | (let ((file (tramp-smb-get-localname localname t)) |
| 379 | (tmpfil (tramp-make-temp-file filename))) | 374 | (tmpfile (tramp-make-temp-file filename))) |
| 380 | (unless (file-exists-p filename) | 375 | (unless (file-exists-p filename) |
| 381 | (tramp-error | 376 | (tramp-error |
| 382 | v 'file-error | 377 | v 'file-error |
| 383 | "Cannot make local copy of non-existing file `%s'" filename)) | 378 | "Cannot make local copy of non-existing file `%s'" filename)) |
| 384 | (tramp-message v 4 "Fetching %s to tmp file %s..." filename tmpfil) | 379 | (tramp-message v 4 "Fetching %s to tmp file %s..." filename tmpfile) |
| 385 | (if (tramp-smb-send-command v (format "get \"%s\" %s" file tmpfil)) | 380 | (if (tramp-smb-send-command v (format "get \"%s\" %s" file tmpfile)) |
| 386 | (tramp-message | 381 | (tramp-message |
| 387 | v 4 "Fetching %s to tmp file %s...done" filename tmpfil) | 382 | v 4 "Fetching %s to tmp file %s...done" filename tmpfile) |
| 388 | (tramp-error | 383 | (tramp-error |
| 389 | v 'file-error | 384 | v 'file-error |
| 390 | "Cannot make local copy of file `%s'" filename)) | 385 | "Cannot make local copy of file `%s'" filename)) |
| 391 | tmpfil))) | 386 | tmpfile))) |
| 392 | 387 | ||
| 393 | ;; This function should return "foo/" for directories and "bar" for | 388 | ;; This function should return "foo/" for directories and "bar" for |
| 394 | ;; files. | 389 | ;; files. |
| @@ -580,7 +575,7 @@ Catches errors for shares like \"C$/\", which are common in Microsoft Windows." | |||
| 580 | (unless (eq append nil) | 575 | (unless (eq append nil) |
| 581 | (tramp-error | 576 | (tramp-error |
| 582 | v 'file-error "Cannot append to file using tramp (`%s')" filename)) | 577 | v 'file-error "Cannot append to file using tramp (`%s')" filename)) |
| 583 | ;; XEmacs takes a coding system as the seventh argument, not `confirm' | 578 | ;; XEmacs takes a coding system as the seventh argument, not `confirm'. |
| 584 | (when (and (not (featurep 'xemacs)) | 579 | (when (and (not (featurep 'xemacs)) |
| 585 | confirm (file-exists-p filename)) | 580 | confirm (file-exists-p filename)) |
| 586 | (unless (y-or-n-p (format "File %s exists; overwrite anyway? " | 581 | (unless (y-or-n-p (format "File %s exists; overwrite anyway? " |
| @@ -592,25 +587,23 @@ Catches errors for shares like \"C$/\", which are common in Microsoft Windows." | |||
| 592 | (tramp-flush-file-property v localname) | 587 | (tramp-flush-file-property v localname) |
| 593 | (let ((file (tramp-smb-get-localname localname t)) | 588 | (let ((file (tramp-smb-get-localname localname t)) |
| 594 | (curbuf (current-buffer)) | 589 | (curbuf (current-buffer)) |
| 595 | tmpfil) | 590 | (tmpfile (tramp-make-temp-file filename))) |
| 596 | ;; Write region into a tmp file. | ||
| 597 | (setq tmpfil (tramp-make-temp-file filename)) | ||
| 598 | ;; We say `no-message' here because we don't want the visited file | 591 | ;; We say `no-message' here because we don't want the visited file |
| 599 | ;; modtime data to be clobbered from the temp file. We call | 592 | ;; modtime data to be clobbered from the temp file. We call |
| 600 | ;; `set-visited-file-modtime' ourselves later on. | 593 | ;; `set-visited-file-modtime' ourselves later on. |
| 601 | (tramp-run-real-handler | 594 | (tramp-run-real-handler |
| 602 | 'write-region | 595 | 'write-region |
| 603 | (if confirm ; don't pass this arg unless defined for backward compat. | 596 | (if confirm ; don't pass this arg unless defined for backward compat. |
| 604 | (list start end tmpfil append 'no-message lockname confirm) | 597 | (list start end tmpfile append 'no-message lockname confirm) |
| 605 | (list start end tmpfil append 'no-message lockname))) | 598 | (list start end tmpfile append 'no-message lockname))) |
| 606 | 599 | ||
| 607 | (tramp-message v 5 "Writing tmp file %s to file %s..." tmpfil filename) | 600 | (tramp-message v 5 "Writing tmp file %s to file %s..." tmpfile filename) |
| 608 | (if (tramp-smb-send-command v (format "put %s \"%s\"" tmpfil file)) | 601 | (if (tramp-smb-send-command v (format "put %s \"%s\"" tmpfile file)) |
| 609 | (tramp-message | 602 | (tramp-message |
| 610 | v 5 "Writing tmp file %s to file %s...done" tmpfil filename) | 603 | v 5 "Writing tmp file %s to file %s...done" tmpfile filename) |
| 611 | (tramp-error v 'file-error "Cannot write `%s'" filename)) | 604 | (tramp-error v 'file-error "Cannot write `%s'" filename)) |
| 612 | 605 | ||
| 613 | (delete-file tmpfil) | 606 | (delete-file tmpfile) |
| 614 | (unless (equal curbuf (current-buffer)) | 607 | (unless (equal curbuf (current-buffer)) |
| 615 | (tramp-error | 608 | (tramp-error |
| 616 | v 'file-error | 609 | v 'file-error |
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 9c446137545..fcd18a2387c 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el | |||
| @@ -73,18 +73,10 @@ | |||
| 73 | (unload-feature 'trampver 'force)))) | 73 | (unload-feature 'trampver 'force)))) |
| 74 | 74 | ||
| 75 | (require 'tramp-compat) | 75 | (require 'tramp-compat) |
| 76 | 76 | (add-hook 'tramp-unload-hook | |
| 77 | ;; `directory-sep-char' is an obsolete variable in Emacs. But it is | 77 | '(lambda () |
| 78 | ;; used in XEmacs, so we set it here and there. The following is needed | 78 | (when (featurep 'tramp-compat) |
| 79 | ;; to pacify Emacs byte-compiler. | 79 | (unload-feature 'tramp-compat 'force)))) |
| 80 | (eval-when-compile | ||
| 81 | (setq byte-compile-not-obsolete-var 'directory-sep-char)) | ||
| 82 | |||
| 83 | (require 'custom) | ||
| 84 | |||
| 85 | (if (featurep 'xemacs) | ||
| 86 | (require 'timer-funcs) | ||
| 87 | (require 'timer)) | ||
| 88 | 80 | ||
| 89 | (require 'format-spec) ;from Gnus 5.8, also in tar ball | 81 | (require 'format-spec) ;from Gnus 5.8, also in tar ball |
| 90 | ;; As long as password.el is not part of (X)Emacs, it shouldn't | 82 | ;; As long as password.el is not part of (X)Emacs, it shouldn't |
| @@ -176,7 +168,7 @@ | |||
| 176 | :version "22.1") | 168 | :version "22.1") |
| 177 | 169 | ||
| 178 | (defcustom tramp-verbose 3 | 170 | (defcustom tramp-verbose 3 |
| 179 | "*Verbosity level for tramp. | 171 | "*Verbosity level for Tramp. |
| 180 | Any level x includes messages for all levels 1 .. x-1. The levels are | 172 | Any level x includes messages for all levels 1 .. x-1. The levels are |
| 181 | 173 | ||
| 182 | 0 silent (no tramp messages at all) | 174 | 0 silent (no tramp messages at all) |
| @@ -1279,7 +1271,7 @@ See `tramp-file-name-structure' for more explanations.") | |||
| 1279 | ((equal tramp-syntax 'sep) tramp-file-name-regexp-separate) | 1271 | ((equal tramp-syntax 'sep) tramp-file-name-regexp-separate) |
| 1280 | ((equal tramp-syntax 'url) tramp-file-name-regexp-url) | 1272 | ((equal tramp-syntax 'url) tramp-file-name-regexp-url) |
| 1281 | (t (error "Wrong `tramp-syntax' defined"))) | 1273 | (t (error "Wrong `tramp-syntax' defined"))) |
| 1282 | "*Regular expression matching file names handled by tramp. | 1274 | "*Regular expression matching file names handled by Tramp. |
| 1283 | This regexp should match tramp file names but no other file names. | 1275 | This regexp should match tramp file names but no other file names. |
| 1284 | \(When tramp.el is loaded, this regular expression is prepended to | 1276 | \(When tramp.el is loaded, this regular expression is prepended to |
| 1285 | `file-name-handler-alist', and that is searched sequentially. Thus, | 1277 | `file-name-handler-alist', and that is searched sequentially. Thus, |
| @@ -1762,6 +1754,8 @@ This is used to map a mode number to a permission string.") | |||
| 1762 | (file-local-copy . tramp-handle-file-local-copy) | 1754 | (file-local-copy . tramp-handle-file-local-copy) |
| 1763 | (file-remote-p . tramp-handle-file-remote-p) | 1755 | (file-remote-p . tramp-handle-file-remote-p) |
| 1764 | (insert-file-contents . tramp-handle-insert-file-contents) | 1756 | (insert-file-contents . tramp-handle-insert-file-contents) |
| 1757 | (insert-file-contents-literally | ||
| 1758 | . tramp-handle-insert-file-contents-literally) | ||
| 1765 | (write-region . tramp-handle-write-region) | 1759 | (write-region . tramp-handle-write-region) |
| 1766 | (find-backup-file-name . tramp-handle-find-backup-file-name) | 1760 | (find-backup-file-name . tramp-handle-find-backup-file-name) |
| 1767 | (make-auto-save-file-name . tramp-handle-make-auto-save-file-name) | 1761 | (make-auto-save-file-name . tramp-handle-make-auto-save-file-name) |
| @@ -1982,9 +1976,9 @@ The intent is to protect against `obsolete variable' warnings." | |||
| 1982 | 1976 | ||
| 1983 | (defsubst tramp-make-temp-file (filename) | 1977 | (defsubst tramp-make-temp-file (filename) |
| 1984 | (concat | 1978 | (concat |
| 1985 | (funcall (if (fboundp 'make-temp-file) 'make-temp-file 'make-temp-name) | 1979 | (make-temp-name |
| 1986 | (expand-file-name tramp-temp-name-prefix | 1980 | (expand-file-name |
| 1987 | (tramp-compat-temporary-file-directory))) | 1981 | tramp-temp-name-prefix (tramp-compat-temporary-file-directory))) |
| 1988 | (file-name-extension filename t))) | 1982 | (file-name-extension filename t))) |
| 1989 | 1983 | ||
| 1990 | (defsubst tramp-make-tramp-temp-file (vec) | 1984 | (defsubst tramp-make-tramp-temp-file (vec) |
| @@ -3159,18 +3153,11 @@ the uid and gid from FILENAME." | |||
| 3159 | (t2 | 3153 | (t2 |
| 3160 | (tramp-send-command | 3154 | (tramp-send-command |
| 3161 | v (format | 3155 | v (format |
| 3162 | "%s %s %s" cmd | 3156 | "mv -f %s %s" |
| 3163 | (tramp-shell-quote-argument tmpfile) | 3157 | (tramp-shell-quote-argument tmpfile) |
| 3164 | (tramp-shell-quote-argument localname2)))) | 3158 | (tramp-shell-quote-argument localname2)))) |
| 3165 | (t1 | 3159 | (t1 |
| 3166 | (if (eq op 'copy) | 3160 | (rename-file tmpfile localname2 ok-if-already-exists)))))))) |
| 3167 | (tramp-compat-copy-file | ||
| 3168 | tmpfile localname2 ok-if-already-exists | ||
| 3169 | keep-date preserve-uid-gid) | ||
| 3170 | (rename-file tmpfile localname2 ok-if-already-exists)))) | ||
| 3171 | |||
| 3172 | ;; Remove temporary file. | ||
| 3173 | (when (eq op 'copy) (delete-file tmpfile))))))) | ||
| 3174 | 3161 | ||
| 3175 | ;; Set the time and mode. Mask possible errors. | 3162 | ;; Set the time and mode. Mask possible errors. |
| 3176 | ;; Won't be applied for 'rename. | 3163 | ;; Won't be applied for 'rename. |
| @@ -3811,7 +3798,7 @@ beginning of local filename are not substituted." | |||
| 3811 | (with-parsed-tramp-file-name filename nil | 3798 | (with-parsed-tramp-file-name filename nil |
| 3812 | (let ((rem-enc (tramp-get-remote-coding v "remote-encoding")) | 3799 | (let ((rem-enc (tramp-get-remote-coding v "remote-encoding")) |
| 3813 | (loc-dec (tramp-get-local-coding v "local-decoding")) | 3800 | (loc-dec (tramp-get-local-coding v "local-decoding")) |
| 3814 | (tmpfil (tramp-make-temp-file filename))) | 3801 | (tmpfile (tramp-make-temp-file filename))) |
| 3815 | (unless (file-exists-p filename) | 3802 | (unless (file-exists-p filename) |
| 3816 | (tramp-error | 3803 | (tramp-error |
| 3817 | v 'file-error | 3804 | v 'file-error |
| @@ -3822,7 +3809,7 @@ beginning of local filename are not substituted." | |||
| 3822 | ((or (tramp-local-host-p v) | 3809 | ((or (tramp-local-host-p v) |
| 3823 | (and (tramp-method-out-of-band-p v) | 3810 | (and (tramp-method-out-of-band-p v) |
| 3824 | (> (nth 7 (file-attributes filename)) tramp-copy-size-limit))) | 3811 | (> (nth 7 (file-attributes filename)) tramp-copy-size-limit))) |
| 3825 | (copy-file filename tmpfil t t)) | 3812 | (copy-file filename tmpfile t t)) |
| 3826 | 3813 | ||
| 3827 | ;; Use inline encoding for file transfer. | 3814 | ;; Use inline encoding for file transfer. |
| 3828 | (rem-enc | 3815 | (rem-enc |
| @@ -3847,29 +3834,29 @@ beginning of local filename are not substituted." | |||
| 3847 | filename loc-dec) | 3834 | filename loc-dec) |
| 3848 | (funcall loc-dec (point-min) (point-max)) | 3835 | (funcall loc-dec (point-min) (point-max)) |
| 3849 | (let ((coding-system-for-write 'binary)) | 3836 | (let ((coding-system-for-write 'binary)) |
| 3850 | (write-region (point-min) (point-max) tmpfil)))) | 3837 | (write-region (point-min) (point-max) tmpfile)))) |
| 3851 | ;; If tramp-decoding-function is not defined for this | 3838 | ;; If tramp-decoding-function is not defined for this |
| 3852 | ;; method, we invoke tramp-decoding-command instead. | 3839 | ;; method, we invoke tramp-decoding-command instead. |
| 3853 | (let ((tmpfil2 (tramp-make-temp-file filename))) | 3840 | (let ((tmpfile2 (tramp-make-temp-file filename))) |
| 3854 | (let ((coding-system-for-write 'binary)) | 3841 | (let ((coding-system-for-write 'binary)) |
| 3855 | (write-region (point-min) (point-max) tmpfil2)) | 3842 | (write-region (point-min) (point-max) tmpfile2)) |
| 3856 | (tramp-message | 3843 | (tramp-message |
| 3857 | v 5 "Decoding remote file %s with command %s..." | 3844 | v 5 "Decoding remote file %s with command %s..." |
| 3858 | filename loc-dec) | 3845 | filename loc-dec) |
| 3859 | (tramp-call-local-coding-command loc-dec tmpfil2 tmpfil) | 3846 | (tramp-call-local-coding-command loc-dec tmpfile2 tmpfile) |
| 3860 | (delete-file tmpfil2))) | 3847 | (delete-file tmpfile2))) |
| 3861 | (tramp-message v 5 "Decoding remote file %s...done" filename) | 3848 | (tramp-message v 5 "Decoding remote file %s...done" filename) |
| 3862 | ;; Set proper permissions. | 3849 | ;; Set proper permissions. |
| 3863 | (set-file-modes tmpfil (file-modes filename)) | 3850 | (set-file-modes tmpfile (file-modes filename)) |
| 3864 | ;; Set local user ownership. | 3851 | ;; Set local user ownership. |
| 3865 | (tramp-set-file-uid-gid tmpfil))) | 3852 | (tramp-set-file-uid-gid tmpfile))) |
| 3866 | 3853 | ||
| 3867 | ;; Oops, I don't know what to do. | 3854 | ;; Oops, I don't know what to do. |
| 3868 | (t (tramp-error | 3855 | (t (tramp-error |
| 3869 | v 'file-error "Wrong method specification for `%s'" method))) | 3856 | v 'file-error "Wrong method specification for `%s'" method))) |
| 3870 | 3857 | ||
| 3871 | (run-hooks 'tramp-handle-file-local-copy-hook) | 3858 | (run-hooks 'tramp-handle-file-local-copy-hook) |
| 3872 | tmpfil))) | 3859 | tmpfile))) |
| 3873 | 3860 | ||
| 3874 | (defun tramp-handle-file-remote-p (filename &optional identification connected) | 3861 | (defun tramp-handle-file-remote-p (filename &optional identification connected) |
| 3875 | "Like `file-remote-p' for Tramp files." | 3862 | "Like `file-remote-p' for Tramp files." |
| @@ -3906,7 +3893,7 @@ beginning of local filename are not substituted." | |||
| 3906 | (if (and (tramp-local-host-p v) | 3893 | (if (and (tramp-local-host-p v) |
| 3907 | (file-readable-p localname)) | 3894 | (file-readable-p localname)) |
| 3908 | ;; Short track: if we are on the local host, we can run directly. | 3895 | ;; Short track: if we are on the local host, we can run directly. |
| 3909 | (insert-file-contents localname visit beg end replace) | 3896 | (setq result (insert-file-contents localname visit beg end replace)) |
| 3910 | 3897 | ||
| 3911 | ;; `insert-file-contents-literally' takes care to avoid calling | 3898 | ;; `insert-file-contents-literally' takes care to avoid calling |
| 3912 | ;; jka-compr. By let-binding inhibit-file-name-operation, we | 3899 | ;; jka-compr. By let-binding inhibit-file-name-operation, we |
| @@ -3935,6 +3922,28 @@ beginning of local filename are not substituted." | |||
| 3935 | (list (expand-file-name filename) | 3922 | (list (expand-file-name filename) |
| 3936 | (cadr result)))))) | 3923 | (cadr result)))))) |
| 3937 | 3924 | ||
| 3925 | ;; This is needed for XEmacs only. Code stolen from files.el. | ||
| 3926 | (defun tramp-handle-insert-file-contents-literally | ||
| 3927 | (filename &optional visit beg end replace) | ||
| 3928 | "Like `insert-file-contents-literally' for Tramp files." | ||
| 3929 | (let ((format-alist nil) | ||
| 3930 | (after-insert-file-functions nil) | ||
| 3931 | (coding-system-for-read 'no-conversion) | ||
| 3932 | (coding-system-for-write 'no-conversion) | ||
| 3933 | (find-buffer-file-type-function | ||
| 3934 | (if (fboundp 'find-buffer-file-type) | ||
| 3935 | (symbol-function 'find-buffer-file-type) | ||
| 3936 | nil)) | ||
| 3937 | (inhibit-file-name-handlers '(jka-compr-handler image-file-handler)) | ||
| 3938 | (inhibit-file-name-operation 'insert-file-contents)) | ||
| 3939 | (unwind-protect | ||
| 3940 | (progn | ||
| 3941 | (fset 'find-buffer-file-type (lambda (filename) t)) | ||
| 3942 | (insert-file-contents filename visit beg end replace)) | ||
| 3943 | (if find-buffer-file-type-function | ||
| 3944 | (fset 'find-buffer-file-type find-buffer-file-type-function) | ||
| 3945 | (fmakunbound 'find-buffer-file-type))))) | ||
| 3946 | |||
| 3938 | (defun tramp-handle-find-backup-file-name (filename) | 3947 | (defun tramp-handle-find-backup-file-name (filename) |
| 3939 | "Like `find-backup-file-name' for Tramp files." | 3948 | "Like `find-backup-file-name' for Tramp files." |
| 3940 | (with-parsed-tramp-file-name filename nil | 3949 | (with-parsed-tramp-file-name filename nil |
| @@ -4041,7 +4050,7 @@ Returns a file name in `tramp-auto-save-directory' for autosaving this file." | |||
| 4041 | ;; (error | 4050 | ;; (error |
| 4042 | ;; "tramp-handle-write-region: LOCKNAME must be nil or equal FILENAME")) | 4051 | ;; "tramp-handle-write-region: LOCKNAME must be nil or equal FILENAME")) |
| 4043 | 4052 | ||
| 4044 | ;; XEmacs takes a coding system as the seventh argument, not `confirm' | 4053 | ;; XEmacs takes a coding system as the seventh argument, not `confirm'. |
| 4045 | (when (and (not (featurep 'xemacs)) confirm (file-exists-p filename)) | 4054 | (when (and (not (featurep 'xemacs)) confirm (file-exists-p filename)) |
| 4046 | (unless (y-or-n-p (format "File %s exists; overwrite anyway? " filename)) | 4055 | (unless (y-or-n-p (format "File %s exists; overwrite anyway? " filename)) |
| 4047 | (tramp-error v 'file-error "File not overwritten"))) | 4056 | (tramp-error v 'file-error "File not overwritten"))) |
| @@ -4059,7 +4068,7 @@ Returns a file name in `tramp-auto-save-directory' for autosaving this file." | |||
| 4059 | ;; Write region into a tmp file. This isn't really needed if we | 4068 | ;; Write region into a tmp file. This isn't really needed if we |
| 4060 | ;; use an encoding function, but currently we use it always | 4069 | ;; use an encoding function, but currently we use it always |
| 4061 | ;; because this makes the logic simpler. | 4070 | ;; because this makes the logic simpler. |
| 4062 | (tmpfil (tramp-make-temp-file filename))) | 4071 | (tmpfile (tramp-make-temp-file filename))) |
| 4063 | 4072 | ||
| 4064 | (if (and (tramp-local-host-p v) | 4073 | (if (and (tramp-local-host-p v) |
| 4065 | (file-writable-p (file-name-directory localname))) | 4074 | (file-writable-p (file-name-directory localname))) |
| @@ -4075,8 +4084,8 @@ Returns a file name in `tramp-auto-save-directory' for autosaving this file." | |||
| 4075 | (tramp-run-real-handler | 4084 | (tramp-run-real-handler |
| 4076 | 'write-region | 4085 | 'write-region |
| 4077 | (if confirm ; don't pass this arg unless defined for backward compat. | 4086 | (if confirm ; don't pass this arg unless defined for backward compat. |
| 4078 | (list start end tmpfil append 'no-message lockname confirm) | 4087 | (list start end tmpfile append 'no-message lockname confirm) |
| 4079 | (list start end tmpfil append 'no-message lockname))) | 4088 | (list start end tmpfile append 'no-message lockname))) |
| 4080 | ;; Now, `last-coding-system-used' has the right value. Remember it. | 4089 | ;; Now, `last-coding-system-used' has the right value. Remember it. |
| 4081 | (when (boundp 'last-coding-system-used) | 4090 | (when (boundp 'last-coding-system-used) |
| 4082 | (setq coding-system-used (symbol-value 'last-coding-system-used))) | 4091 | (setq coding-system-used (symbol-value 'last-coding-system-used))) |
| @@ -4084,7 +4093,7 @@ Returns a file name in `tramp-auto-save-directory' for autosaving this file." | |||
| 4084 | ;; filename does not exist (eq modes nil) it has been renamed to | 4093 | ;; filename does not exist (eq modes nil) it has been renamed to |
| 4085 | ;; the backup file. This case `save-buffer' handles | 4094 | ;; the backup file. This case `save-buffer' handles |
| 4086 | ;; permissions. | 4095 | ;; permissions. |
| 4087 | (when modes (set-file-modes tmpfil modes)) | 4096 | (when modes (set-file-modes tmpfile modes)) |
| 4088 | 4097 | ||
| 4089 | ;; This is a bit lengthy due to the different methods possible for | 4098 | ;; This is a bit lengthy due to the different methods possible for |
| 4090 | ;; file transfer. First, we check whether the method uses an rcp | 4099 | ;; file transfer. First, we check whether the method uses an rcp |
| @@ -4098,11 +4107,11 @@ Returns a file name in `tramp-auto-save-directory' for autosaving this file." | |||
| 4098 | (and (tramp-method-out-of-band-p v) | 4107 | (and (tramp-method-out-of-band-p v) |
| 4099 | (integerp start) | 4108 | (integerp start) |
| 4100 | (> (- end start) tramp-copy-size-limit))) | 4109 | (> (- end start) tramp-copy-size-limit))) |
| 4101 | (rename-file tmpfil filename t)) | 4110 | (rename-file tmpfile filename t)) |
| 4102 | 4111 | ||
| 4103 | ;; Use inline file transfer | 4112 | ;; Use inline file transfer |
| 4104 | (rem-dec | 4113 | (rem-dec |
| 4105 | ;; Encode tmpfil | 4114 | ;; Encode tmpfile |
| 4106 | (tramp-message v 5 "Encoding region...") | 4115 | (tramp-message v 5 "Encoding region...") |
| 4107 | (unwind-protect | 4116 | (unwind-protect |
| 4108 | (with-temp-buffer | 4117 | (with-temp-buffer |
| @@ -4113,7 +4122,7 @@ Returns a file name in `tramp-auto-save-directory' for autosaving this file." | |||
| 4113 | v 5 "Encoding region using function `%s'..." | 4122 | v 5 "Encoding region using function `%s'..." |
| 4114 | (symbol-name loc-enc)) | 4123 | (symbol-name loc-enc)) |
| 4115 | (let ((coding-system-for-read 'binary)) | 4124 | (let ((coding-system-for-read 'binary)) |
| 4116 | (insert-file-contents-literally tmpfil)) | 4125 | (insert-file-contents-literally tmpfile)) |
| 4117 | ;; CCC. The following `let' is a workaround for | 4126 | ;; CCC. The following `let' is a workaround for |
| 4118 | ;; the base64.el that comes with pgnus-0.84. If | 4127 | ;; the base64.el that comes with pgnus-0.84. If |
| 4119 | ;; both of the following conditions are | 4128 | ;; both of the following conditions are |
| @@ -4130,7 +4139,7 @@ Returns a file name in `tramp-auto-save-directory' for autosaving this file." | |||
| 4130 | (tramp-message | 4139 | (tramp-message |
| 4131 | v 5 "Encoding region using command `%s'..." loc-enc) | 4140 | v 5 "Encoding region using command `%s'..." loc-enc) |
| 4132 | (unless (equal 0 (tramp-call-local-coding-command | 4141 | (unless (equal 0 (tramp-call-local-coding-command |
| 4133 | loc-enc tmpfil t)) | 4142 | loc-enc tmpfile t)) |
| 4134 | (tramp-error | 4143 | (tramp-error |
| 4135 | v 'file-error | 4144 | v 'file-error |
| 4136 | "Cannot write to `%s', local encoding command `%s' failed" | 4145 | "Cannot write to `%s', local encoding command `%s' failed" |
| @@ -4156,14 +4165,14 @@ Returns a file name in `tramp-auto-save-directory' for autosaving this file." | |||
| 4156 | filename rem-dec) | 4165 | filename rem-dec) |
| 4157 | ;; When `file-precious-flag' is set, the region is | 4166 | ;; When `file-precious-flag' is set, the region is |
| 4158 | ;; written to a temporary file. Check that the | 4167 | ;; written to a temporary file. Check that the |
| 4159 | ;; checksum is equal to that from the local tmpfil. | 4168 | ;; checksum is equal to that from the local tmpfile. |
| 4160 | (when file-precious-flag | 4169 | (when file-precious-flag |
| 4161 | (erase-buffer) | 4170 | (erase-buffer) |
| 4162 | (and | 4171 | (and |
| 4163 | ;; cksum runs locally | 4172 | ;; cksum runs locally |
| 4164 | (let ((default-directory | 4173 | (let ((default-directory |
| 4165 | (tramp-compat-temporary-file-directory))) | 4174 | (tramp-compat-temporary-file-directory))) |
| 4166 | (zerop (call-process "cksum" tmpfil t))) | 4175 | (zerop (call-process "cksum" tmpfile t))) |
| 4167 | ;; cksum runs remotely | 4176 | ;; cksum runs remotely |
| 4168 | (zerop | 4177 | (zerop |
| 4169 | (tramp-send-command-and-check | 4178 | (tramp-send-command-and-check |
| @@ -4184,7 +4193,7 @@ Returns a file name in `tramp-auto-save-directory' for autosaving this file." | |||
| 4184 | (tramp-flush-file-property v localname)) | 4193 | (tramp-flush-file-property v localname)) |
| 4185 | 4194 | ||
| 4186 | ;; Save exit. | 4195 | ;; Save exit. |
| 4187 | (delete-file tmpfil))) | 4196 | (delete-file tmpfile))) |
| 4188 | 4197 | ||
| 4189 | ;; That's not expected. | 4198 | ;; That's not expected. |
| 4190 | (t | 4199 | (t |
| @@ -4568,22 +4577,32 @@ Falls back to normal file name handler if no tramp file name handler exists." | |||
| 4568 | "Checks whether method / user name / host name completion is active." | 4577 | "Checks whether method / user name / host name completion is active." |
| 4569 | (or | 4578 | (or |
| 4570 | ;; Emacs | 4579 | ;; Emacs |
| 4571 | (not (memq last-input-event '(return newline))) | 4580 | (equal last-input-event 'tab) |
| 4572 | (and (natnump last-input-event) | 4581 | (and (natnump last-input-event) |
| 4573 | (not (char-equal last-input-event ?\n)) | 4582 | (or |
| 4574 | (not (char-equal last-input-event ?\r))) | 4583 | ;; ?\t has event-modifier 'control |
| 4584 | (char-equal last-input-event ?\t) | ||
| 4585 | (and (not (event-modifiers last-input-event)) | ||
| 4586 | (or (char-equal last-input-event ?\?) | ||
| 4587 | (char-equal last-input-event ?\ ))))) | ||
| 4575 | ;; XEmacs | 4588 | ;; XEmacs |
| 4576 | (and (featurep 'xemacs) | 4589 | (and (featurep 'xemacs) |
| 4577 | ;; `last-input-event' might be nil. | 4590 | ;; `last-input-event' might be nil. |
| 4578 | (not (null last-input-event)) | 4591 | (not (null last-input-event)) |
| 4579 | ;; `last-input-event' may have no character approximation. | 4592 | ;; `last-input-event' may have no character approximation. |
| 4580 | (funcall (symbol-function 'event-to-character) last-input-event) | 4593 | (funcall (symbol-function 'event-to-character) last-input-event) |
| 4581 | (not (char-equal | 4594 | (or |
| 4582 | (funcall (symbol-function 'event-to-character) | 4595 | ;; ?\t has event-modifier 'control |
| 4583 | last-input-event) ?\n)) | 4596 | (char-equal |
| 4584 | (not (char-equal | 4597 | (funcall (symbol-function 'event-to-character) |
| 4585 | (funcall (symbol-function 'event-to-character) | 4598 | last-input-event) ?\t) |
| 4586 | last-input-event) ?\r))))) | 4599 | (and (not (event-modifiers last-input-event)) |
| 4600 | (or (char-equal | ||
| 4601 | (funcall (symbol-function 'event-to-character) | ||
| 4602 | last-input-event) ?\?) | ||
| 4603 | (char-equal | ||
| 4604 | (funcall (symbol-function 'event-to-character) | ||
| 4605 | last-input-event) ?\ ))))))) | ||
| 4587 | 4606 | ||
| 4588 | ;; Method, host name and user name completion. | 4607 | ;; Method, host name and user name completion. |
| 4589 | ;; `tramp-completion-dissect-file-name' returns a list of | 4608 | ;; `tramp-completion-dissect-file-name' returns a list of |
| @@ -6644,8 +6663,7 @@ would yield `t'. On the other hand, the following check results in nil: | |||
| 6644 | (tramp-equal-remote \"/sudo::/etc\" \"/su::/etc\")" | 6663 | (tramp-equal-remote \"/sudo::/etc\" \"/su::/etc\")" |
| 6645 | (and (stringp (file-remote-p file1)) | 6664 | (and (stringp (file-remote-p file1)) |
| 6646 | (stringp (file-remote-p file2)) | 6665 | (stringp (file-remote-p file2)) |
| 6647 | (string-equal (file-remote-p file1) | 6666 | (string-equal (file-remote-p file1) (file-remote-p file2)))) |
| 6648 | (file-remote-p file2)))) | ||
| 6649 | 6667 | ||
| 6650 | (defun tramp-make-tramp-file-name (method user host localname) | 6668 | (defun tramp-make-tramp-file-name (method user host localname) |
| 6651 | "Constructs a Tramp file name from METHOD, USER, HOST and LOCALNAME." | 6669 | "Constructs a Tramp file name from METHOD, USER, HOST and LOCALNAME." |
| @@ -7261,7 +7279,7 @@ and what the local and remote machines are. | |||
| 7261 | 7279 | ||
| 7262 | If you can give a simple set of instructions to make this bug | 7280 | If you can give a simple set of instructions to make this bug |
| 7263 | happen reliably, please include those. Thank you for helping | 7281 | happen reliably, please include those. Thank you for helping |
| 7264 | kill bugs in TRAMP. | 7282 | kill bugs in Tramp. |
| 7265 | 7283 | ||
| 7266 | Another useful thing to do is to put | 7284 | Another useful thing to do is to put |
| 7267 | 7285 | ||