diff options
| author | Michael Albinus | 2010-09-08 16:42:54 +0200 |
|---|---|---|
| committer | Michael Albinus | 2010-09-08 16:42:54 +0200 |
| commit | 0f34aa7719df0621663d41defa5deaf79004c52c (patch) | |
| tree | 99158c302c8c932f6383720dd5f9c55e49c384a7 | |
| parent | 308e764f26f61572067a959f6cbf94d7bd3f2e4e (diff) | |
| download | emacs-0f34aa7719df0621663d41defa5deaf79004c52c.tar.gz emacs-0f34aa7719df0621663d41defa5deaf79004c52c.zip | |
Migrate to Tramp 2.2. Rearrange load dependencies.
(Bug#1529, Bug#5448, Bug#5705)
* Makefile.in (TRAMP_DIR, TRAMP_SRC): New variables.
($(TRAMP_DIR)/tramp-loaddefs.el): New target.
(LOADDEFS): Add $(lisp)/net/tramp-loaddefs.el.
* net/tramp.el (top): Remove all other tramp-* loads except
tramp-compat.el. Remove all changes to tramp-unload-hook for
other tramp-* packages. Rearrange defun order. Change calls of
`tramp-compat-call-process', `tramp-compat-decimal-to-octal',
`tramp-compat-octal-to-decimal' to new function names.
(tramp-terminal-type, tramp-initial-end-of-output)
(tramp-methods, tramp-foreign-file-name-handler-alist)
(tramp-tramp-file-p, tramp-completion-mode-p)
(tramp-send-command-and-check, tramp-get-remote-path)
(tramp-get-remote-tmpdir, tramp-get-remote-ln)
(tramp-shell-quote-argument): Set tramp-autoload cookie.
(with-file-property, with-connection-property): Move to
tramp-cache.el.
(tramp-local-call-process, tramp-decimal-to-octal)
(tramp-octal-to-decimal): Move to tramp-compat.el.
(tramp-handle-shell-command): Do not require 'shell.
(tramp-compute-multi-hops): No special handling for tramp-gw-*
symbols.
(tramp-unload-tramp): Do not call `tramp-unload-file-name-handlers'.
* net/tramp-cache.el (top): Require 'tramp. Add to
`tramp-unload-hook'.
(tramp-cache-data, tramp-get-file-property)
(tramp-set-file-property, tramp-flush-file-property)
(tramp-flush-directory-property, tramp-get-connection-property)
(tramp-set-connection-property, tramp-flush-connection-property)
(tramp-cache-print, tramp-list-connections): Set tramp-autoload
cookie.
(with-file-property, with-connection-property): New defuns, moved
from tramp.el.
(tramp-flush-file-function): Use `with-parsed-tramp-file-name'
macro.
* net/tramp-cmds.el (top): Add to `tramp-unload-hook'.
(tramp-version): Set tramp-autoload cookie.
* net/tramp-compat.el (top): Require 'tramp-loaddefs. Remove all
changes to tramp-unload-hook for other tramp-* packages. Add to
`tramp-unload-hook'.
(tramp-compat-decimal-to-octal, tramp-compat-octal-to-decimal)
(tramp-compat-call-process): New defuns, moved from tramp.el.
* net/tramp-fish.el (top) Require just 'tramp. Add objects to
`tramp-methods' and `tramp-foreign-file-name-handler-alist'. Add
to `tramp-unload-hook'. Change call of
`tramp-compat-decimal-to-octal' to new function name.
(tramp-fish-method): Make it a defconst.
(tramp-fish-file-name-p): Make it a defsubst.
(tramp-fish-method, tramp-fish-file-name-handler)
(tramp-fish-file-name-p): Set tramp-autoload cookie.
* net/tramp-ftp.el (top) Add objects to `tramp-methods' and
`tramp-foreign-file-name-handler-alist'. Add to
`tramp-unload-hook'.
(tramp-ftp-method): Make it a defconst.
(tramp-ftp-file-name-p): Make it a defsubst.
(tramp-ftp-method, tramp-ftp-file-name-handler)
(tramp-ftp-file-name-p): Set tramp-autoload cookie.
* net/tramp-gvfs.el (top) Add objects to `tramp-methods' and
`tramp-foreign-file-name-handler-alist'. Add to
`tramp-unload-hook'. Change checks, whether package can be
loaded.
(tramp-gvfs-file-name-p): Make it a defsubst.
(tramp-gvfs-methods, tramp-gvfs-file-name-handler)
(tramp-gvfs-file-name-p): Set tramp-autoload cookie.
(tramp-gvfs-handle-file-directory-p): New defun.
(tramp-gvfs-file-name-handler-alist): Use it.
* net/tramp-gw.el (top) Add objects to `tramp-methods' and
`tramp-foreign-file-name-handler-alist'. Add to
`tramp-unload-hook'.
(tramp-gw-tunnel-method, tramp-gw-default-tunnel-port)
(tramp-gw-socks-method, tramp-gw-default-socks-port): Make it a
defconst.
(tramp-gw-tunnel-method, tramp-gw-socks-method)
(tramp-gw-open-connection): Set tramp-autoload cookie.
* net/tramp-imap.el (top) Require just 'tramp. Add objects to
`tramp-methods' and `tramp-foreign-file-name-handler-alist'. Add
to `tramp-unload-hook'. Change checks, whether package can be
loaded.
(tramp-imap-file-name-p): Make it a defsubst.
(tramp-imap-method, tramp-imaps-method)
(tramp-imap-file-name-handler)
(tramp-imap-file-name-p): Set tramp-autoload cookie.
* net/tramp-smb.el (top) Require just 'tramp. Add objects to
`tramp-methods' and `tramp-foreign-file-name-handler-alist'. Add
to `tramp-unload-hook'. Change checks, whether package can be
loaded. Change call of `tramp-compat-decimal-to-octal' to new
function name.
(tramp-smb-tunnel-method): Make it a defconst.
(tramp-smb-file-name-p): Make it a defsubst.
(tramp-smb-method, tramp-smb-file-name-handler)
(tramp-smb-file-name-p): Set tramp-autoload cookie.
* net/tramp-uu.el (top) Add to `tramp-unload-hook'.
(tramp-uuencode-region): Set tramp-autoload cookie.
* net/trampver.el (top) Add to `tramp-unload-hook'.
(tramp-version, tramp-bug-report-address): Set tramp-autoload
cookie. Update release number.
| -rw-r--r-- | lisp/ChangeLog | 113 | ||||
| -rw-r--r-- | lisp/Makefile.in | 21 | ||||
| -rw-r--r-- | lisp/net/tramp-cache.el | 69 | ||||
| -rw-r--r-- | lisp/net/tramp-cmds.el | 8 | ||||
| -rw-r--r-- | lisp/net/tramp-compat.el | 55 | ||||
| -rw-r--r-- | lisp/net/tramp-fish.el | 21 | ||||
| -rw-r--r-- | lisp/net/tramp-ftp.el | 26 | ||||
| -rw-r--r-- | lisp/net/tramp-gvfs.el | 42 | ||||
| -rw-r--r-- | lisp/net/tramp-gw.el | 25 | ||||
| -rw-r--r-- | lisp/net/tramp-imap.el | 27 | ||||
| -rw-r--r-- | lisp/net/tramp-smb.el | 30 | ||||
| -rw-r--r-- | lisp/net/tramp-uu.el | 5 | ||||
| -rw-r--r-- | lisp/net/tramp.el | 744 | ||||
| -rw-r--r-- | lisp/net/trampver.el | 17 |
14 files changed, 667 insertions, 536 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index bfe3534eeb7..d967bbbd87e 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,116 @@ | |||
| 1 | 2010-09-08 Michael Albinus <michael.albinus@gmx.de> | ||
| 2 | |||
| 3 | Migrate to Tramp 2.2. Rearrange load dependencies. | ||
| 4 | (Bug#1529, Bug#5448, Bug#5705) | ||
| 5 | |||
| 6 | * Makefile.in (TRAMP_DIR, TRAMP_SRC): New variables. | ||
| 7 | ($(TRAMP_DIR)/tramp-loaddefs.el): New target. | ||
| 8 | (LOADDEFS): Add $(lisp)/net/tramp-loaddefs.el. | ||
| 9 | |||
| 10 | * net/tramp.el (top): Remove all other tramp-* loads except | ||
| 11 | tramp-compat.el. Remove all changes to tramp-unload-hook for | ||
| 12 | other tramp-* packages. Rearrange defun order. Change calls of | ||
| 13 | `tramp-compat-call-process', `tramp-compat-decimal-to-octal', | ||
| 14 | `tramp-compat-octal-to-decimal' to new function names. | ||
| 15 | (tramp-terminal-type, tramp-initial-end-of-output) | ||
| 16 | (tramp-methods, tramp-foreign-file-name-handler-alist) | ||
| 17 | (tramp-tramp-file-p, tramp-completion-mode-p) | ||
| 18 | (tramp-send-command-and-check, tramp-get-remote-path) | ||
| 19 | (tramp-get-remote-tmpdir, tramp-get-remote-ln) | ||
| 20 | (tramp-shell-quote-argument): Set tramp-autoload cookie. | ||
| 21 | (with-file-property, with-connection-property): Move to | ||
| 22 | tramp-cache.el. | ||
| 23 | (tramp-local-call-process, tramp-decimal-to-octal) | ||
| 24 | (tramp-octal-to-decimal): Move to tramp-compat.el. | ||
| 25 | (tramp-handle-shell-command): Do not require 'shell. | ||
| 26 | (tramp-compute-multi-hops): No special handling for tramp-gw-* | ||
| 27 | symbols. | ||
| 28 | (tramp-unload-tramp): Do not call `tramp-unload-file-name-handlers'. | ||
| 29 | |||
| 30 | * net/tramp-cache.el (top): Require 'tramp. Add to | ||
| 31 | `tramp-unload-hook'. | ||
| 32 | (tramp-cache-data, tramp-get-file-property) | ||
| 33 | (tramp-set-file-property, tramp-flush-file-property) | ||
| 34 | (tramp-flush-directory-property, tramp-get-connection-property) | ||
| 35 | (tramp-set-connection-property, tramp-flush-connection-property) | ||
| 36 | (tramp-cache-print, tramp-list-connections): Set tramp-autoload | ||
| 37 | cookie. | ||
| 38 | (with-file-property, with-connection-property): New defuns, moved | ||
| 39 | from tramp.el. | ||
| 40 | (tramp-flush-file-function): Use `with-parsed-tramp-file-name' | ||
| 41 | macro. | ||
| 42 | |||
| 43 | * net/tramp-cmds.el (top): Add to `tramp-unload-hook'. | ||
| 44 | (tramp-version): Set tramp-autoload cookie. | ||
| 45 | |||
| 46 | * net/tramp-compat.el (top): Require 'tramp-loaddefs. Remove all | ||
| 47 | changes to tramp-unload-hook for other tramp-* packages. Add to | ||
| 48 | `tramp-unload-hook'. | ||
| 49 | (tramp-compat-decimal-to-octal, tramp-compat-octal-to-decimal) | ||
| 50 | (tramp-compat-call-process): New defuns, moved from tramp.el. | ||
| 51 | |||
| 52 | * net/tramp-fish.el (top) Require just 'tramp. Add objects to | ||
| 53 | `tramp-methods' and `tramp-foreign-file-name-handler-alist'. Add | ||
| 54 | to `tramp-unload-hook'. Change call of | ||
| 55 | `tramp-compat-decimal-to-octal' to new function name. | ||
| 56 | (tramp-fish-method): Make it a defconst. | ||
| 57 | (tramp-fish-file-name-p): Make it a defsubst. | ||
| 58 | (tramp-fish-method, tramp-fish-file-name-handler) | ||
| 59 | (tramp-fish-file-name-p): Set tramp-autoload cookie. | ||
| 60 | |||
| 61 | * net/tramp-ftp.el (top) Add objects to `tramp-methods' and | ||
| 62 | `tramp-foreign-file-name-handler-alist'. Add to | ||
| 63 | `tramp-unload-hook'. | ||
| 64 | (tramp-ftp-method): Make it a defconst. | ||
| 65 | (tramp-ftp-file-name-p): Make it a defsubst. | ||
| 66 | (tramp-ftp-method, tramp-ftp-file-name-handler) | ||
| 67 | (tramp-ftp-file-name-p): Set tramp-autoload cookie. | ||
| 68 | |||
| 69 | * net/tramp-gvfs.el (top) Add objects to `tramp-methods' and | ||
| 70 | `tramp-foreign-file-name-handler-alist'. Add to | ||
| 71 | `tramp-unload-hook'. Change checks, whether package can be | ||
| 72 | loaded. | ||
| 73 | (tramp-gvfs-file-name-p): Make it a defsubst. | ||
| 74 | (tramp-gvfs-methods, tramp-gvfs-file-name-handler) | ||
| 75 | (tramp-gvfs-file-name-p): Set tramp-autoload cookie. | ||
| 76 | (tramp-gvfs-handle-file-directory-p): New defun. | ||
| 77 | (tramp-gvfs-file-name-handler-alist): Use it. | ||
| 78 | |||
| 79 | * net/tramp-gw.el (top) Add objects to `tramp-methods' and | ||
| 80 | `tramp-foreign-file-name-handler-alist'. Add to | ||
| 81 | `tramp-unload-hook'. | ||
| 82 | (tramp-gw-tunnel-method, tramp-gw-default-tunnel-port) | ||
| 83 | (tramp-gw-socks-method, tramp-gw-default-socks-port): Make it a | ||
| 84 | defconst. | ||
| 85 | (tramp-gw-tunnel-method, tramp-gw-socks-method) | ||
| 86 | (tramp-gw-open-connection): Set tramp-autoload cookie. | ||
| 87 | |||
| 88 | * net/tramp-imap.el (top) Require just 'tramp. Add objects to | ||
| 89 | `tramp-methods' and `tramp-foreign-file-name-handler-alist'. Add | ||
| 90 | to `tramp-unload-hook'. Change checks, whether package can be | ||
| 91 | loaded. | ||
| 92 | (tramp-imap-file-name-p): Make it a defsubst. | ||
| 93 | (tramp-imap-method, tramp-imaps-method) | ||
| 94 | (tramp-imap-file-name-handler) | ||
| 95 | (tramp-imap-file-name-p): Set tramp-autoload cookie. | ||
| 96 | |||
| 97 | * net/tramp-smb.el (top) Require just 'tramp. Add objects to | ||
| 98 | `tramp-methods' and `tramp-foreign-file-name-handler-alist'. Add | ||
| 99 | to `tramp-unload-hook'. Change checks, whether package can be | ||
| 100 | loaded. Change call of `tramp-compat-decimal-to-octal' to new | ||
| 101 | function name. | ||
| 102 | (tramp-smb-tunnel-method): Make it a defconst. | ||
| 103 | (tramp-smb-file-name-p): Make it a defsubst. | ||
| 104 | (tramp-smb-method, tramp-smb-file-name-handler) | ||
| 105 | (tramp-smb-file-name-p): Set tramp-autoload cookie. | ||
| 106 | |||
| 107 | * net/tramp-uu.el (top) Add to `tramp-unload-hook'. | ||
| 108 | (tramp-uuencode-region): Set tramp-autoload cookie. | ||
| 109 | |||
| 110 | * net/trampver.el (top) Add to `tramp-unload-hook'. | ||
| 111 | (tramp-version, tramp-bug-report-address): Set tramp-autoload | ||
| 112 | cookie. Update release number. | ||
| 113 | |||
| 1 | 2010-09-07 AgustÃn MartÃn <agustin.martin@hispalinux.es> | 114 | 2010-09-07 AgustÃn MartÃn <agustin.martin@hispalinux.es> |
| 2 | 115 | ||
| 3 | * textmodes/ispell.el (ispell-start-process): Make sure original | 116 | * textmodes/ispell.el (ispell-start-process): Make sure original |
diff --git a/lisp/Makefile.in b/lisp/Makefile.in index 8d681b4f673..918ce0ecc64 100644 --- a/lisp/Makefile.in +++ b/lisp/Makefile.in | |||
| @@ -56,7 +56,8 @@ ETAGS = ../lib-src/etags | |||
| 56 | LOADDEFS = $(lisp)/calendar/cal-loaddefs.el \ | 56 | LOADDEFS = $(lisp)/calendar/cal-loaddefs.el \ |
| 57 | $(lisp)/calendar/diary-loaddefs.el \ | 57 | $(lisp)/calendar/diary-loaddefs.el \ |
| 58 | $(lisp)/calendar/hol-loaddefs.el \ | 58 | $(lisp)/calendar/hol-loaddefs.el \ |
| 59 | $(lisp)/mh-e/mh-loaddefs.el | 59 | $(lisp)/mh-e/mh-loaddefs.el \ |
| 60 | $(lisp)/net/tramp-loaddefs.el | ||
| 60 | 61 | ||
| 61 | # Elisp files auto-generated. | 62 | # Elisp files auto-generated. |
| 62 | AUTOGENEL = loaddefs.el \ | 63 | AUTOGENEL = loaddefs.el \ |
| @@ -329,6 +330,24 @@ $(MH_E_DIR)/mh-loaddefs.el: $(MH_E_SRC) | |||
| 329 | --eval "(setq make-backup-files nil)" \ | 330 | --eval "(setq make-backup-files nil)" \ |
| 330 | -f batch-update-autoloads $(MH_E_DIR) | 331 | -f batch-update-autoloads $(MH_E_DIR) |
| 331 | 332 | ||
| 333 | # Update TRAMP internal autoloads. Maybe we could move trmp*.el into | ||
| 334 | # an own subdirectory. OTOH, it does not hurt to keep them in | ||
| 335 | # lisp/net. | ||
| 336 | TRAMP_DIR = $(lisp)/net | ||
| 337 | TRAMP_SRC = $(TRAMP_DIR)/tramp.el $(TRAMP_DIR)/tramp-cache.el \ | ||
| 338 | $(TRAMP_DIR)/tramp-cmds.el $(TRAMP_DIR)/tramp-compat.el \ | ||
| 339 | $(TRAMP_DIR)/tramp-fish.el $(TRAMP_DIR)/tramp-ftp.el \ | ||
| 340 | $(TRAMP_DIR)/tramp-gvfs.el $(TRAMP_DIR)/tramp-gw.el \ | ||
| 341 | $(TRAMP_DIR)/tramp-imap.el $(TRAMP_DIR)/tramp-smb.el \ | ||
| 342 | $(TRAMP_DIR)/tramp-uu.el $(TRAMP_DIR)/trampver.el | ||
| 343 | |||
| 344 | $(TRAMP_DIR)/tramp-loaddefs.el: $(TRAMP_SRC) | ||
| 345 | $(emacs) -l autoload \ | ||
| 346 | --eval "(setq generate-autoload-cookie \";;;###tramp-autoload\")" \ | ||
| 347 | --eval "(setq generated-autoload-file \"$@\")" \ | ||
| 348 | --eval "(setq make-backup-files nil)" \ | ||
| 349 | -f batch-update-autoloads $(TRAMP_DIR) | ||
| 350 | |||
| 332 | CAL_DIR = $(lisp)/calendar | 351 | CAL_DIR = $(lisp)/calendar |
| 333 | ## Those files that may contain internal calendar autoload cookies. | 352 | ## Those files that may contain internal calendar autoload cookies. |
| 334 | ## Avoids circular dependency warning for *-loaddefs.el. | 353 | ## Avoids circular dependency warning for *-loaddefs.el. |
diff --git a/lisp/net/tramp-cache.el b/lisp/net/tramp-cache.el index 9c8ab4cb017..7ec4c4066f1 100644 --- a/lisp/net/tramp-cache.el +++ b/lisp/net/tramp-cache.el | |||
| @@ -50,24 +50,12 @@ | |||
| 50 | 50 | ||
| 51 | ;;; Code: | 51 | ;;; Code: |
| 52 | 52 | ||
| 53 | ;; Pacify byte-compiler. | 53 | (require 'tramp) |
| 54 | (eval-when-compile | 54 | (autoload 'time-stamp-string "time-stamp") |
| 55 | (require 'cl) | ||
| 56 | (autoload 'tramp-message "tramp") | ||
| 57 | (autoload 'tramp-tramp-file-p "tramp") | ||
| 58 | ;; We cannot autoload macro `with-parsed-tramp-file-name', it | ||
| 59 | ;; results in problems of byte-compiled code. | ||
| 60 | (autoload 'tramp-dissect-file-name "tramp") | ||
| 61 | (autoload 'tramp-file-name-method "tramp") | ||
| 62 | (autoload 'tramp-file-name-user "tramp") | ||
| 63 | (autoload 'tramp-file-name-host "tramp") | ||
| 64 | (autoload 'tramp-file-name-localname "tramp") | ||
| 65 | (autoload 'tramp-run-real-handler "tramp") | ||
| 66 | (autoload 'tramp-time-less-p "tramp") | ||
| 67 | (autoload 'time-stamp-string "time-stamp")) | ||
| 68 | 55 | ||
| 69 | ;;; -- Cache -- | 56 | ;;; -- Cache -- |
| 70 | 57 | ||
| 58 | ;;;###tramp-autoload | ||
| 71 | (defvar tramp-cache-data (make-hash-table :test 'equal) | 59 | (defvar tramp-cache-data (make-hash-table :test 'equal) |
| 72 | "Hash table for remote files properties.") | 60 | "Hash table for remote files properties.") |
| 73 | 61 | ||
| @@ -103,6 +91,7 @@ time.") | |||
| 103 | (defvar tramp-cache-data-changed nil | 91 | (defvar tramp-cache-data-changed nil |
| 104 | "Whether persistent cache data have been changed.") | 92 | "Whether persistent cache data have been changed.") |
| 105 | 93 | ||
| 94 | ;;;###tramp-autoload | ||
| 106 | (defun tramp-get-file-property (vec file property default) | 95 | (defun tramp-get-file-property (vec file property default) |
| 107 | "Get the PROPERTY of FILE from the cache context of VEC. | 96 | "Get the PROPERTY of FILE from the cache context of VEC. |
| 108 | Returns DEFAULT if not set." | 97 | Returns DEFAULT if not set." |
| @@ -130,6 +119,7 @@ Returns DEFAULT if not set." | |||
| 130 | (tramp-message vec 8 "%s %s %s" file property value) | 119 | (tramp-message vec 8 "%s %s %s" file property value) |
| 131 | value)) | 120 | value)) |
| 132 | 121 | ||
| 122 | ;;;###tramp-autoload | ||
| 133 | (defun tramp-set-file-property (vec file property value) | 123 | (defun tramp-set-file-property (vec file property value) |
| 134 | "Set the PROPERTY of FILE to VALUE, in the cache context of VEC. | 124 | "Set the PROPERTY of FILE to VALUE, in the cache context of VEC. |
| 135 | Returns VALUE." | 125 | Returns VALUE." |
| @@ -144,6 +134,26 @@ Returns VALUE." | |||
| 144 | (tramp-message vec 8 "%s %s %s" file property value) | 134 | (tramp-message vec 8 "%s %s %s" file property value) |
| 145 | value)) | 135 | value)) |
| 146 | 136 | ||
| 137 | ;;;###tramp-autoload | ||
| 138 | (defmacro with-file-property (vec file property &rest body) | ||
| 139 | "Check in Tramp cache for PROPERTY, otherwise execute BODY and set cache. | ||
| 140 | FILE must be a local file name on a connection identified via VEC." | ||
| 141 | `(if (file-name-absolute-p ,file) | ||
| 142 | (let ((value (tramp-get-file-property ,vec ,file ,property 'undef))) | ||
| 143 | (when (eq value 'undef) | ||
| 144 | ;; We cannot pass @body as parameter to | ||
| 145 | ;; `tramp-set-file-property' because it mangles our | ||
| 146 | ;; debug messages. | ||
| 147 | (setq value (progn ,@body)) | ||
| 148 | (tramp-set-file-property ,vec ,file ,property value)) | ||
| 149 | value) | ||
| 150 | ,@body)) | ||
| 151 | |||
| 152 | (put 'with-file-property 'lisp-indent-function 3) | ||
| 153 | (put 'with-file-property 'edebug-form-spec t) | ||
| 154 | (font-lock-add-keywords 'emacs-lisp-mode '("\\<with-file-property\\>")) | ||
| 155 | |||
| 156 | ;;;###tramp-autoload | ||
| 147 | (defun tramp-flush-file-property (vec file) | 157 | (defun tramp-flush-file-property (vec file) |
| 148 | "Remove all properties of FILE in the cache context of VEC." | 158 | "Remove all properties of FILE in the cache context of VEC." |
| 149 | ;; Unify localname. | 159 | ;; Unify localname. |
| @@ -152,6 +162,7 @@ Returns VALUE." | |||
| 152 | (tramp-message vec 8 "%s" file) | 162 | (tramp-message vec 8 "%s" file) |
| 153 | (remhash vec tramp-cache-data)) | 163 | (remhash vec tramp-cache-data)) |
| 154 | 164 | ||
| 165 | ;;;###tramp-autoload | ||
| 155 | (defun tramp-flush-directory-property (vec directory) | 166 | (defun tramp-flush-directory-property (vec directory) |
| 156 | "Remove all properties of DIRECTORY in the cache context of VEC. | 167 | "Remove all properties of DIRECTORY in the cache context of VEC. |
| 157 | Remove also properties of all files in subdirectories." | 168 | Remove also properties of all files in subdirectories." |
| @@ -175,8 +186,7 @@ Remove also properties of all files in subdirectories." | |||
| 175 | (buffer-file-name) | 186 | (buffer-file-name) |
| 176 | default-directory))) | 187 | default-directory))) |
| 177 | (when (tramp-tramp-file-p bfn) | 188 | (when (tramp-tramp-file-p bfn) |
| 178 | (let* ((v (tramp-dissect-file-name bfn)) | 189 | (with-parsed-tramp-file-name bfn nil |
| 179 | (localname (tramp-file-name-localname v))) | ||
| 180 | (tramp-flush-file-property v localname))))) | 190 | (tramp-flush-file-property v localname))))) |
| 181 | 191 | ||
| 182 | (add-hook 'before-revert-hook 'tramp-flush-file-function) | 192 | (add-hook 'before-revert-hook 'tramp-flush-file-function) |
| @@ -193,6 +203,7 @@ Remove also properties of all files in subdirectories." | |||
| 193 | 203 | ||
| 194 | ;;; -- Properties -- | 204 | ;;; -- Properties -- |
| 195 | 205 | ||
| 206 | ;;;###tramp-autoload | ||
| 196 | (defun tramp-get-connection-property (key property default) | 207 | (defun tramp-get-connection-property (key property default) |
| 197 | "Get the named PROPERTY for the connection. | 208 | "Get the named PROPERTY for the connection. |
| 198 | KEY identifies the connection, it is either a process or a vector. | 209 | KEY identifies the connection, it is either a process or a vector. |
| @@ -209,6 +220,7 @@ If the value is not set for the connection, returns DEFAULT." | |||
| 209 | (tramp-message key 7 "%s %s" property value) | 220 | (tramp-message key 7 "%s %s" property value) |
| 210 | value)) | 221 | value)) |
| 211 | 222 | ||
| 223 | ;;;###tramp-autoload | ||
| 212 | (defun tramp-set-connection-property (key property value) | 224 | (defun tramp-set-connection-property (key property value) |
| 213 | "Set the named PROPERTY of a connection to VALUE. | 225 | "Set the named PROPERTY of a connection to VALUE. |
| 214 | KEY identifies the connection, it is either a process or a vector. | 226 | KEY identifies the connection, it is either a process or a vector. |
| @@ -231,6 +243,23 @@ PROPERTY is set persistent when KEY is a vector." | |||
| 231 | (error nil)) | 243 | (error nil)) |
| 232 | value)) | 244 | value)) |
| 233 | 245 | ||
| 246 | ;;;###tramp-autoload | ||
| 247 | (defmacro with-connection-property (key property &rest body) | ||
| 248 | "Check in Tramp for property PROPERTY, otherwise executes BODY and set." | ||
| 249 | `(let ((value (tramp-get-connection-property ,key ,property 'undef))) | ||
| 250 | (when (eq value 'undef) | ||
| 251 | ;; We cannot pass ,@body as parameter to | ||
| 252 | ;; `tramp-set-connection-property' because it mangles our debug | ||
| 253 | ;; messages. | ||
| 254 | (setq value (progn ,@body)) | ||
| 255 | (tramp-set-connection-property ,key ,property value)) | ||
| 256 | value)) | ||
| 257 | |||
| 258 | (put 'with-connection-property 'lisp-indent-function 2) | ||
| 259 | (put 'with-connection-property 'edebug-form-spec t) | ||
| 260 | (font-lock-add-keywords 'emacs-lisp-mode '("\\<with-connection-property\\>")) | ||
| 261 | |||
| 262 | ;;;###tramp-autoload | ||
| 234 | (defun tramp-flush-connection-property (key) | 263 | (defun tramp-flush-connection-property (key) |
| 235 | "Remove all properties identified by KEY. | 264 | "Remove all properties identified by KEY. |
| 236 | KEY identifies the connection, it is either a process or a vector." | 265 | KEY identifies the connection, it is either a process or a vector." |
| @@ -251,6 +280,7 @@ KEY identifies the connection, it is either a process or a vector." | |||
| 251 | (setq tramp-cache-data-changed t) | 280 | (setq tramp-cache-data-changed t) |
| 252 | (remhash key tramp-cache-data)) | 281 | (remhash key tramp-cache-data)) |
| 253 | 282 | ||
| 283 | ;;;###tramp-autoload | ||
| 254 | (defun tramp-cache-print (table) | 284 | (defun tramp-cache-print (table) |
| 255 | "Print hash table TABLE." | 285 | "Print hash table TABLE." |
| 256 | (when (hash-table-p table) | 286 | (when (hash-table-p table) |
| @@ -271,6 +301,7 @@ KEY identifies the connection, it is either a process or a vector." | |||
| 271 | table) | 301 | table) |
| 272 | result))) | 302 | result))) |
| 273 | 303 | ||
| 304 | ;;;###tramp-autoload | ||
| 274 | (defun tramp-list-connections () | 305 | (defun tramp-list-connections () |
| 275 | "Return a list of all known connection vectors according to `tramp-cache'." | 306 | "Return a list of all known connection vectors according to `tramp-cache'." |
| 276 | (let (result) | 307 | (let (result) |
| @@ -364,6 +395,10 @@ for all methods. Resulting data are derived from connection history." | |||
| 364 | tramp-persistency-file-name (error-message-string err)) | 395 | tramp-persistency-file-name (error-message-string err)) |
| 365 | (clrhash tramp-cache-data)))) | 396 | (clrhash tramp-cache-data)))) |
| 366 | 397 | ||
| 398 | (add-hook 'tramp-unload-hook | ||
| 399 | (lambda () | ||
| 400 | (unload-feature 'tramp-cache 'force))) | ||
| 401 | |||
| 367 | (provide 'tramp-cache) | 402 | (provide 'tramp-cache) |
| 368 | 403 | ||
| 369 | ;; arch-tag: ee1739b7-7628-408c-9b96-d11a74b05d26 | 404 | ;; arch-tag: ee1739b7-7628-408c-9b96-d11a74b05d26 |
diff --git a/lisp/net/tramp-cmds.el b/lisp/net/tramp-cmds.el index c3243083695..32cbb16b9e8 100644 --- a/lisp/net/tramp-cmds.el +++ b/lisp/net/tramp-cmds.el | |||
| @@ -129,6 +129,7 @@ This includes password cache, file cache, connection cache, buffers." | |||
| 129 | 129 | ||
| 130 | ;; Tramp version is useful in a number of situations. | 130 | ;; Tramp version is useful in a number of situations. |
| 131 | 131 | ||
| 132 | ;;;###tramp-autoload | ||
| 132 | (defun tramp-version (arg) | 133 | (defun tramp-version (arg) |
| 133 | "Print version number of tramp.el in minibuffer or current buffer." | 134 | "Print version number of tramp.el in minibuffer or current buffer." |
| 134 | (interactive "P") | 135 | (interactive "P") |
| @@ -387,6 +388,9 @@ please ensure that the buffers are attached to your email.\n\n") | |||
| 387 | 388 | ||
| 388 | (defalias 'tramp-submit-bug 'tramp-bug) | 389 | (defalias 'tramp-submit-bug 'tramp-bug) |
| 389 | 390 | ||
| 391 | (add-hook 'tramp-unload-hook | ||
| 392 | (lambda () (unload-feature 'tramp-cmds 'force))) | ||
| 393 | |||
| 390 | (provide 'tramp-cmds) | 394 | (provide 'tramp-cmds) |
| 391 | 395 | ||
| 392 | ;;; TODO: | 396 | ;;; TODO: |
| @@ -395,7 +399,7 @@ please ensure that the buffers are attached to your email.\n\n") | |||
| 395 | ;; * WIBNI there was an interactive command prompting for Tramp | 399 | ;; * WIBNI there was an interactive command prompting for Tramp |
| 396 | ;; method, hostname, username and filename and translates the user | 400 | ;; method, hostname, username and filename and translates the user |
| 397 | ;; input into the correct filename syntax (depending on the Emacs | 401 | ;; input into the correct filename syntax (depending on the Emacs |
| 398 | ;; flavor) (Reiner Steib) | 402 | ;; flavor) (Reiner Steib) |
| 399 | ;; * Let the user edit the connection properties interactively. | 403 | ;; * Let the user edit the connection properties interactively. |
| 400 | ;; Something like `gnus-server-edit-server' in Gnus' *Server* buffer. | 404 | ;; Something like `gnus-server-edit-server' in Gnus' *Server* buffer. |
| 401 | ;; * It's just that when I come to Customize `tramp-default-user-alist' | 405 | ;; * It's just that when I come to Customize `tramp-default-user-alist' |
| @@ -404,7 +408,7 @@ please ensure that the buffers are attached to your email.\n\n") | |||
| 404 | ;; Option and should not be modified by the code. add-to-list is | 408 | ;; Option and should not be modified by the code. add-to-list is |
| 405 | ;; called in several places. One way to handle that is to have a new | 409 | ;; called in several places. One way to handle that is to have a new |
| 406 | ;; ordinary variable that gets its initial value from | 410 | ;; ordinary variable that gets its initial value from |
| 407 | ;; tramp-default-user-alist and then is added to. (Pete Forman) | 411 | ;; tramp-default-user-alist and then is added to. (Pete Forman) |
| 408 | 412 | ||
| 409 | ;; arch-tag: 190d4c33-76bb-4e99-8b6f-71741f23d98c | 413 | ;; arch-tag: 190d4c33-76bb-4e99-8b6f-71741f23d98c |
| 410 | ;;; tramp-cmds.el ends here | 414 | ;;; tramp-cmds.el ends here |
diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el index 92ad7811189..cd2f0b0ddf5 100644 --- a/lisp/net/tramp-compat.el +++ b/lisp/net/tramp-compat.el | |||
| @@ -29,6 +29,8 @@ | |||
| 29 | 29 | ||
| 30 | ;;; Code: | 30 | ;;; Code: |
| 31 | 31 | ||
| 32 | (require 'tramp-loaddefs) | ||
| 33 | |||
| 32 | (eval-when-compile | 34 | (eval-when-compile |
| 33 | 35 | ||
| 34 | ;; Pacify byte-compiler. | 36 | ;; Pacify byte-compiler. |
| @@ -43,33 +45,20 @@ | |||
| 43 | (require 'timer-funcs) | 45 | (require 'timer-funcs) |
| 44 | (require 'timer)) | 46 | (require 'timer)) |
| 45 | 47 | ||
| 46 | (autoload 'tramp-tramp-file-p "tramp") | ||
| 47 | (autoload 'tramp-file-name-handler "tramp") | ||
| 48 | |||
| 49 | ;; We check whether `start-file-process' is bound. | 48 | ;; We check whether `start-file-process' is bound. |
| 50 | (unless (fboundp 'start-file-process) | 49 | (unless (fboundp 'start-file-process) |
| 51 | 50 | ||
| 52 | ;; tramp-util offers integration into other (X)Emacs packages like | 51 | ;; tramp-util offers integration into other (X)Emacs packages like |
| 53 | ;; compile.el, gud.el etc. Not necessary in Emacs 23. | 52 | ;; compile.el, gud.el etc. Not necessary in Emacs 23. |
| 54 | (eval-after-load "tramp" | 53 | (eval-after-load "tramp" |
| 55 | '(progn | 54 | '(require 'tramp-util)) |
| 56 | (require 'tramp-util) | ||
| 57 | (add-hook 'tramp-unload-hook | ||
| 58 | '(lambda () | ||
| 59 | (when (featurep 'tramp-util) | ||
| 60 | (unload-feature 'tramp-util 'force)))))) | ||
| 61 | 55 | ||
| 62 | ;; Make sure that we get integration with the VC package. When it | 56 | ;; Make sure that we get integration with the VC package. When it |
| 63 | ;; is loaded, we need to pull in the integration module. Not | 57 | ;; is loaded, we need to pull in the integration module. Not |
| 64 | ;; necessary in Emacs 23. | 58 | ;; necessary in Emacs 23. |
| 65 | (eval-after-load "vc" | 59 | (eval-after-load "vc" |
| 66 | (eval-after-load "tramp" | 60 | (eval-after-load "tramp" |
| 67 | '(progn | 61 | '(require 'tramp-vc)))) |
| 68 | (require 'tramp-vc) | ||
| 69 | (add-hook 'tramp-unload-hook | ||
| 70 | '(lambda () | ||
| 71 | (when (featurep 'tramp-vc) | ||
| 72 | (unload-feature 'tramp-vc 'force)))))))) | ||
| 73 | 62 | ||
| 74 | ;; Avoid byte-compiler warnings if the byte-compiler supports this. | 63 | ;; Avoid byte-compiler warnings if the byte-compiler supports this. |
| 75 | ;; Currently, XEmacs supports this. | 64 | ;; Currently, XEmacs supports this. |
| @@ -263,6 +252,24 @@ Add the extension of FILENAME, if existing." | |||
| 263 | ;; Default value in XEmacs. | 252 | ;; Default value in XEmacs. |
| 264 | (t 134217727))) | 253 | (t 134217727))) |
| 265 | 254 | ||
| 255 | (defun tramp-compat-decimal-to-octal (i) | ||
| 256 | "Return a string consisting of the octal digits of I. | ||
| 257 | Not actually used. Use `(format \"%o\" i)' instead?" | ||
| 258 | (cond ((< i 0) (error "Cannot convert negative number to octal")) | ||
| 259 | ((not (integerp i)) (error "Cannot convert non-integer to octal")) | ||
| 260 | ((zerop i) "0") | ||
| 261 | (t (concat (tramp-compat-decimal-to-octal (/ i 8)) | ||
| 262 | (number-to-string (% i 8)))))) | ||
| 263 | |||
| 264 | ;; Kudos to Gerd Moellmann for this suggestion. | ||
| 265 | (defun tramp-compat-octal-to-decimal (ostr) | ||
| 266 | "Given a string of octal digits, return a decimal number." | ||
| 267 | (let ((x (or ostr ""))) | ||
| 268 | ;; `save-match' is in `tramp-mode-string-to-int' which calls this. | ||
| 269 | (unless (string-match "\\`[0-7]*\\'" x) | ||
| 270 | (error "Non-octal junk in string `%s'" x)) | ||
| 271 | (string-to-number ostr 8))) | ||
| 272 | |||
| 266 | ;; ID-FORMAT does not exists in XEmacs. | 273 | ;; ID-FORMAT does not exists in XEmacs. |
| 267 | (defun tramp-compat-file-attributes (filename &optional id-format) | 274 | (defun tramp-compat-file-attributes (filename &optional id-format) |
| 268 | "Like `file-attributes' for Tramp files (compat function)." | 275 | "Like `file-attributes' for Tramp files (compat function)." |
| @@ -397,6 +404,20 @@ This is, the first, empty, element is omitted. In XEmacs, the first | |||
| 397 | element is not omitted." | 404 | element is not omitted." |
| 398 | (delete "" (split-string string pattern))) | 405 | (delete "" (split-string string pattern))) |
| 399 | 406 | ||
| 407 | (defun tramp-compat-call-process | ||
| 408 | (program &optional infile destination display &rest args) | ||
| 409 | "Calls `call-process' on the local host. | ||
| 410 | This is needed because for some Emacs flavors Tramp has | ||
| 411 | defadviced `call-process' to behave like `process-file'. The | ||
| 412 | Lisp error raised when PROGRAM is nil is trapped also, returning 1." | ||
| 413 | (let ((default-directory | ||
| 414 | (if (file-remote-p default-directory) | ||
| 415 | (tramp-compat-temporary-file-directory) | ||
| 416 | default-directory))) | ||
| 417 | (if (executable-find program) | ||
| 418 | (apply 'call-process program infile destination display args) | ||
| 419 | 1))) | ||
| 420 | |||
| 400 | (defun tramp-compat-process-running-p (process-name) | 421 | (defun tramp-compat-process-running-p (process-name) |
| 401 | "Returns `t' if system process PROCESS-NAME is running for `user-login-name'." | 422 | "Returns `t' if system process PROCESS-NAME is running for `user-login-name'." |
| 402 | (when (stringp process-name) | 423 | (when (stringp process-name) |
| @@ -439,6 +460,10 @@ element is not omitted." | |||
| 439 | (setenv "UNIX95" unix95) | 460 | (setenv "UNIX95" unix95) |
| 440 | result))))) | 461 | result))))) |
| 441 | 462 | ||
| 463 | (add-hook 'tramp-unload-hook | ||
| 464 | (lambda () | ||
| 465 | (unload-feature 'tramp-compat 'force))) | ||
| 466 | |||
| 442 | (provide 'tramp-compat) | 467 | (provide 'tramp-compat) |
| 443 | 468 | ||
| 444 | ;;; TODO: | 469 | ;;; TODO: |
diff --git a/lisp/net/tramp-fish.el b/lisp/net/tramp-fish.el index 81dea724dd6..e5d0ffd3366 100644 --- a/lisp/net/tramp-fish.el +++ b/lisp/net/tramp-fish.el | |||
| @@ -157,16 +157,14 @@ | |||
| 157 | (require 'cl)) | 157 | (require 'cl)) |
| 158 | 158 | ||
| 159 | (require 'tramp) | 159 | (require 'tramp) |
| 160 | (require 'tramp-cache) | ||
| 161 | (require 'tramp-compat) | ||
| 162 | 160 | ||
| 163 | ;; Define FISH method ... | 161 | ;; Define FISH method ... |
| 164 | (defcustom tramp-fish-method "fish" | 162 | ;;;###tramp-autoload |
| 165 | "*Method to connect via FISH protocol." | 163 | (defconst tramp-fish-method "fish" |
| 166 | :group 'tramp | 164 | "*Method to connect via FISH protocol.") |
| 167 | :type 'string) | ||
| 168 | 165 | ||
| 169 | ;; ... and add it to the method list. | 166 | ;; ... and add it to the method list. |
| 167 | ;;;###tramp-autoload | ||
| 170 | (add-to-list 'tramp-methods (cons tramp-fish-method nil)) | 168 | (add-to-list 'tramp-methods (cons tramp-fish-method nil)) |
| 171 | 169 | ||
| 172 | ;; Add a default for `tramp-default-user-alist'. Default is the local user. | 170 | ;; Add a default for `tramp-default-user-alist'. Default is the local user. |
| @@ -264,11 +262,13 @@ Used instead of analyzing error codes of commands.") | |||
| 264 | "Alist of handler functions for Tramp FISH method. | 262 | "Alist of handler functions for Tramp FISH method. |
| 265 | Operations not mentioned here will be handled by the default Emacs primitives.") | 263 | Operations not mentioned here will be handled by the default Emacs primitives.") |
| 266 | 264 | ||
| 267 | (defun tramp-fish-file-name-p (filename) | 265 | ;;;###tramp-autoload |
| 266 | (defsubst tramp-fish-file-name-p (filename) | ||
| 268 | "Check if it's a filename for FISH protocol." | 267 | "Check if it's a filename for FISH protocol." |
| 269 | (let ((v (tramp-dissect-file-name filename))) | 268 | (let ((v (tramp-dissect-file-name filename))) |
| 270 | (string= (tramp-file-name-method v) tramp-fish-method))) | 269 | (string= (tramp-file-name-method v) tramp-fish-method))) |
| 271 | 270 | ||
| 271 | ;;;###tramp-autoload | ||
| 272 | (defun tramp-fish-file-name-handler (operation &rest args) | 272 | (defun tramp-fish-file-name-handler (operation &rest args) |
| 273 | "Invoke the FISH related OPERATION. | 273 | "Invoke the FISH related OPERATION. |
| 274 | First arg specifies the OPERATION, second arg is a list of arguments to | 274 | First arg specifies the OPERATION, second arg is a list of arguments to |
| @@ -278,6 +278,7 @@ pass to the OPERATION." | |||
| 278 | (save-match-data (apply (cdr fn) args)) | 278 | (save-match-data (apply (cdr fn) args)) |
| 279 | (tramp-run-real-handler operation args)))) | 279 | (tramp-run-real-handler operation args)))) |
| 280 | 280 | ||
| 281 | ;;;###tramp-autoload | ||
| 281 | (add-to-list 'tramp-foreign-file-name-handler-alist | 282 | (add-to-list 'tramp-foreign-file-name-handler-alist |
| 282 | (cons 'tramp-fish-file-name-p 'tramp-fish-file-name-handler)) | 283 | (cons 'tramp-fish-file-name-p 'tramp-fish-file-name-handler)) |
| 283 | 284 | ||
| @@ -688,7 +689,7 @@ target of the symlink differ." | |||
| 688 | (tramp-flush-file-property v localname) | 689 | (tramp-flush-file-property v localname) |
| 689 | (unless (tramp-fish-send-command-and-check | 690 | (unless (tramp-fish-send-command-and-check |
| 690 | v (format "#CHMOD %s %s" | 691 | v (format "#CHMOD %s %s" |
| 691 | (tramp-decimal-to-octal mode) | 692 | (tramp-compat-decimal-to-octal mode) |
| 692 | (tramp-shell-quote-argument localname))) | 693 | (tramp-shell-quote-argument localname))) |
| 693 | (tramp-error | 694 | (tramp-error |
| 694 | v 'file-error "Error while changing file's mode %s" filename)))) | 695 | v 'file-error "Error while changing file's mode %s" filename)))) |
| @@ -1170,6 +1171,10 @@ Returns nil if there has been an error message." | |||
| 1170 | (goto-char (point-min)) | 1171 | (goto-char (point-min)) |
| 1171 | (looking-at tramp-fish-ok-prompt-regexp))) | 1172 | (looking-at tramp-fish-ok-prompt-regexp))) |
| 1172 | 1173 | ||
| 1174 | (add-hook 'tramp-unload-hook | ||
| 1175 | (lambda () | ||
| 1176 | (unload-feature 'tramp-fish 'force))) | ||
| 1177 | |||
| 1173 | (provide 'tramp-fish) | 1178 | (provide 'tramp-fish) |
| 1174 | ; | 1179 | ; |
| 1175 | ;;;; TODO: | 1180 | ;;;; TODO: |
diff --git a/lisp/net/tramp-ftp.el b/lisp/net/tramp-ftp.el index 14cf2e0adbf..799b974bd04 100644 --- a/lisp/net/tramp-ftp.el +++ b/lisp/net/tramp-ftp.el | |||
| @@ -30,7 +30,6 @@ | |||
| 30 | ;;; Code: | 30 | ;;; Code: |
| 31 | 31 | ||
| 32 | (require 'tramp) | 32 | (require 'tramp) |
| 33 | (autoload 'tramp-set-connection-property "tramp-cache") | ||
| 34 | 33 | ||
| 35 | (eval-when-compile | 34 | (eval-when-compile |
| 36 | 35 | ||
| @@ -99,13 +98,14 @@ present for backward compatibility." | |||
| 99 | (add-hook 'tramp-ftp-unload-hook 'tramp-ftp-enable-ange-ftp) | 98 | (add-hook 'tramp-ftp-unload-hook 'tramp-ftp-enable-ange-ftp) |
| 100 | 99 | ||
| 101 | ;; Define FTP method ... | 100 | ;; Define FTP method ... |
| 102 | (defcustom tramp-ftp-method "ftp" | 101 | ;;;###tramp-autoload |
| 103 | "*When this method name is used, forward all calls to Ange-FTP." | 102 | (defconst tramp-ftp-method "ftp" |
| 104 | :group 'tramp | 103 | "*When this method name is used, forward all calls to Ange-FTP.") |
| 105 | :type 'string) | ||
| 106 | 104 | ||
| 107 | ;; ... and add it to the method list. | 105 | ;; ... and add it to the method list. |
| 108 | (add-to-list 'tramp-methods (cons tramp-ftp-method nil)) | 106 | ;;;###tramp-autoload |
| 107 | (unless (featurep 'xemacs) | ||
| 108 | (add-to-list 'tramp-methods (cons tramp-ftp-method nil))) | ||
| 109 | 109 | ||
| 110 | ;; Add some defaults for `tramp-default-method-alist' | 110 | ;; Add some defaults for `tramp-default-method-alist' |
| 111 | (add-to-list 'tramp-default-method-alist | 111 | (add-to-list 'tramp-default-method-alist |
| @@ -129,6 +129,7 @@ present for backward compatibility." | |||
| 129 | (symbol-plist | 129 | (symbol-plist |
| 130 | 'substitute-in-file-name)))))) | 130 | 'substitute-in-file-name)))))) |
| 131 | 131 | ||
| 132 | ;;;###tramp-autoload | ||
| 132 | (defun tramp-ftp-file-name-handler (operation &rest args) | 133 | (defun tramp-ftp-file-name-handler (operation &rest args) |
| 133 | "Invoke the Ange-FTP handler for OPERATION. | 134 | "Invoke the Ange-FTP handler for OPERATION. |
| 134 | First arg specifies the OPERATION, second arg is a list of arguments to | 135 | First arg specifies the OPERATION, second arg is a list of arguments to |
| @@ -199,13 +200,20 @@ pass to the OPERATION." | |||
| 199 | (inhibit-file-name-operation operation)) | 200 | (inhibit-file-name-operation operation)) |
| 200 | (apply 'ange-ftp-hook-function operation args))))))) | 201 | (apply 'ange-ftp-hook-function operation args))))))) |
| 201 | 202 | ||
| 202 | (defun tramp-ftp-file-name-p (filename) | 203 | ;;;###tramp-autoload |
| 204 | (defsubst tramp-ftp-file-name-p (filename) | ||
| 203 | "Check if it's a filename that should be forwarded to Ange-FTP." | 205 | "Check if it's a filename that should be forwarded to Ange-FTP." |
| 204 | (let ((v (tramp-dissect-file-name filename))) | 206 | (let ((v (tramp-dissect-file-name filename))) |
| 205 | (string= (tramp-file-name-method v) tramp-ftp-method))) | 207 | (string= (tramp-file-name-method v) tramp-ftp-method))) |
| 206 | 208 | ||
| 207 | (add-to-list 'tramp-foreign-file-name-handler-alist | 209 | ;;;###tramp-autoload |
| 208 | (cons 'tramp-ftp-file-name-p 'tramp-ftp-file-name-handler)) | 210 | (unless (featurep 'xemacs) |
| 211 | (add-to-list 'tramp-foreign-file-name-handler-alist | ||
| 212 | (cons 'tramp-ftp-file-name-p 'tramp-ftp-file-name-handler))) | ||
| 213 | |||
| 214 | (add-hook 'tramp-unload-hook | ||
| 215 | (lambda () | ||
| 216 | (unload-feature 'tramp-ftp 'force))) | ||
| 209 | 217 | ||
| 210 | (provide 'tramp-ftp) | 218 | (provide 'tramp-ftp) |
| 211 | 219 | ||
diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el index d0814545e6e..6e07ec19021 100644 --- a/lisp/net/tramp-gvfs.el +++ b/lisp/net/tramp-gvfs.el | |||
| @@ -108,6 +108,7 @@ | |||
| 108 | (require 'url-util) | 108 | (require 'url-util) |
| 109 | (require 'zeroconf) | 109 | (require 'zeroconf) |
| 110 | 110 | ||
| 111 | ;;;###tramp-autoload | ||
| 111 | (defcustom tramp-gvfs-methods '("dav" "davs" "obex" "synce") | 112 | (defcustom tramp-gvfs-methods '("dav" "davs" "obex" "synce") |
| 112 | "*List of methods for remote files, accessed with GVFS." | 113 | "*List of methods for remote files, accessed with GVFS." |
| 113 | :group 'tramp | 114 | :group 'tramp |
| @@ -133,11 +134,11 @@ | |||
| 133 | 134 | ||
| 134 | ;; Add the methods to `tramp-methods', in order to allow minibuffer | 135 | ;; Add the methods to `tramp-methods', in order to allow minibuffer |
| 135 | ;; completion. | 136 | ;; completion. |
| 136 | (eval-after-load "tramp-gvfs" | 137 | ;;;###tramp-autoload |
| 137 | '(when (featurep 'tramp-gvfs) | 138 | (when (featurep 'dbusbind) |
| 138 | (dolist (elt tramp-gvfs-methods) | 139 | (dolist (elt tramp-gvfs-methods) |
| 139 | (unless (assoc elt tramp-methods) | 140 | (unless (assoc elt tramp-methods) |
| 140 | (add-to-list 'tramp-methods (cons elt nil)))))) | 141 | (add-to-list 'tramp-methods (cons elt nil))))) |
| 141 | 142 | ||
| 142 | (defconst tramp-gvfs-path-tramp (concat dbus-path-emacs "/Tramp") | 143 | (defconst tramp-gvfs-path-tramp (concat dbus-path-emacs "/Tramp") |
| 143 | "The preceeding object path for own objects.") | 144 | "The preceeding object path for own objects.") |
| @@ -145,9 +146,12 @@ | |||
| 145 | (defconst tramp-gvfs-service-daemon "org.gtk.vfs.Daemon" | 146 | (defconst tramp-gvfs-service-daemon "org.gtk.vfs.Daemon" |
| 146 | "The well known name of the GVFS daemon.") | 147 | "The well known name of the GVFS daemon.") |
| 147 | 148 | ||
| 148 | ;; Check that GVFS is available. | 149 | ;; Check that GVFS is available. D-Bus integration is available since |
| 149 | (unless (dbus-ping :session tramp-gvfs-service-daemon 100) | 150 | ;; Emacs 23 on some system types. We don't call `dbus-ping', because |
| 150 | (throw 'tramp-loading nil)) | 151 | ;; this would load dbus.el. |
| 152 | (unless (and (tramp-compat-funcall 'dbus-get-unique-name :session) | ||
| 153 | (tramp-compat-process-running-p "gvfs-fuse-daemon")) | ||
| 154 | (error "Package `tramp-gvfs' not supported")) | ||
| 151 | 155 | ||
| 152 | (defconst tramp-gvfs-path-mounttracker "/org/gtk/vfs/mounttracker" | 156 | (defconst tramp-gvfs-path-mounttracker "/org/gtk/vfs/mounttracker" |
| 153 | "The object path of the GVFS daemon.") | 157 | "The object path of the GVFS daemon.") |
| @@ -385,7 +389,7 @@ Every entry is a list (NAME ADDRESS).") | |||
| 385 | (expand-file-name . tramp-gvfs-handle-expand-file-name) | 389 | (expand-file-name . tramp-gvfs-handle-expand-file-name) |
| 386 | ;; `file-accessible-directory-p' performed by default handler. | 390 | ;; `file-accessible-directory-p' performed by default handler. |
| 387 | (file-attributes . tramp-gvfs-handle-file-attributes) | 391 | (file-attributes . tramp-gvfs-handle-file-attributes) |
| 388 | (file-directory-p . tramp-smb-handle-file-directory-p) | 392 | (file-directory-p . tramp-gvfs-handle-file-directory-p) |
| 389 | (file-executable-p . tramp-gvfs-handle-file-executable-p) | 393 | (file-executable-p . tramp-gvfs-handle-file-executable-p) |
| 390 | (file-exists-p . tramp-gvfs-handle-file-exists-p) | 394 | (file-exists-p . tramp-gvfs-handle-file-exists-p) |
| 391 | (file-local-copy . tramp-gvfs-handle-file-local-copy) | 395 | (file-local-copy . tramp-gvfs-handle-file-local-copy) |
| @@ -431,13 +435,15 @@ Every entry is a list (NAME ADDRESS).") | |||
| 431 | "Alist of handler functions for Tramp GVFS method. | 435 | "Alist of handler functions for Tramp GVFS method. |
| 432 | Operations not mentioned here will be handled by the default Emacs primitives.") | 436 | Operations not mentioned here will be handled by the default Emacs primitives.") |
| 433 | 437 | ||
| 434 | (defun tramp-gvfs-file-name-p (filename) | 438 | ;;;###tramp-autoload |
| 439 | (defsubst tramp-gvfs-file-name-p (filename) | ||
| 435 | "Check if it's a filename handled by the GVFS daemon." | 440 | "Check if it's a filename handled by the GVFS daemon." |
| 436 | (and (tramp-tramp-file-p filename) | 441 | (and (tramp-tramp-file-p filename) |
| 437 | (let ((method | 442 | (let ((method |
| 438 | (tramp-file-name-method (tramp-dissect-file-name filename)))) | 443 | (tramp-file-name-method (tramp-dissect-file-name filename)))) |
| 439 | (and (stringp method) (member method tramp-gvfs-methods))))) | 444 | (and (stringp method) (member method tramp-gvfs-methods))))) |
| 440 | 445 | ||
| 446 | ;;;###tramp-autoload | ||
| 441 | (defun tramp-gvfs-file-name-handler (operation &rest args) | 447 | (defun tramp-gvfs-file-name-handler (operation &rest args) |
| 442 | "Invoke the GVFS related OPERATION. | 448 | "Invoke the GVFS related OPERATION. |
| 443 | First arg specifies the OPERATION, second arg is a list of arguments to | 449 | First arg specifies the OPERATION, second arg is a list of arguments to |
| @@ -449,8 +455,10 @@ pass to the OPERATION." | |||
| 449 | 455 | ||
| 450 | ;; This might be moved to tramp.el. It shall be the first file name | 456 | ;; This might be moved to tramp.el. It shall be the first file name |
| 451 | ;; handler. | 457 | ;; handler. |
| 452 | (add-to-list 'tramp-foreign-file-name-handler-alist | 458 | ;;;###tramp-autoload |
| 453 | (cons 'tramp-gvfs-file-name-p 'tramp-gvfs-file-name-handler)) | 459 | (when (featurep 'dbusbind) |
| 460 | (add-to-list 'tramp-foreign-file-name-handler-alist | ||
| 461 | (cons 'tramp-gvfs-file-name-p 'tramp-gvfs-file-name-handler))) | ||
| 454 | 462 | ||
| 455 | (defun tramp-gvfs-stringify-dbus-message (message) | 463 | (defun tramp-gvfs-stringify-dbus-message (message) |
| 456 | "Convert a D-Bus message into readable UTF8 strings, used for traces." | 464 | "Convert a D-Bus message into readable UTF8 strings, used for traces." |
| @@ -494,7 +502,7 @@ In case of an error, modify the error message by replacing | |||
| 494 | `(let ((fuse-file-name (regexp-quote (tramp-gvfs-fuse-file-name ,filename))) | 502 | `(let ((fuse-file-name (regexp-quote (tramp-gvfs-fuse-file-name ,filename))) |
| 495 | elt) | 503 | elt) |
| 496 | (condition-case err | 504 | (condition-case err |
| 497 | (funcall ,handler ,@args) | 505 | (tramp-compat-funcall ,handler ,@args) |
| 498 | (error | 506 | (error |
| 499 | (setq elt (cdr err)) | 507 | (setq elt (cdr err)) |
| 500 | (while elt | 508 | (while elt |
| @@ -647,6 +655,10 @@ is no information where to trace the message.") | |||
| 647 | "Like `file-attributes' for Tramp files." | 655 | "Like `file-attributes' for Tramp files." |
| 648 | (file-attributes (tramp-gvfs-fuse-file-name filename) id-format)) | 656 | (file-attributes (tramp-gvfs-fuse-file-name filename) id-format)) |
| 649 | 657 | ||
| 658 | (defun tramp-gvfs-handle-file-directory-p (filename) | ||
| 659 | "Like `file-directory-p' for Tramp files." | ||
| 660 | (file-directory-p (tramp-gvfs-fuse-file-name filename))) | ||
| 661 | |||
| 650 | (defun tramp-gvfs-handle-file-executable-p (filename) | 662 | (defun tramp-gvfs-handle-file-executable-p (filename) |
| 651 | "Like `file-executable-p' for Tramp files." | 663 | "Like `file-executable-p' for Tramp files." |
| 652 | (file-executable-p (tramp-gvfs-fuse-file-name filename))) | 664 | (file-executable-p (tramp-gvfs-fuse-file-name filename))) |
| @@ -1403,6 +1415,10 @@ They are retrieved from the hal daemon." | |||
| 1403 | (tramp-set-completion-function | 1415 | (tramp-set-completion-function |
| 1404 | "synce" '((tramp-synce-parse-device-names ""))) | 1416 | "synce" '((tramp-synce-parse-device-names ""))) |
| 1405 | 1417 | ||
| 1418 | (add-hook 'tramp-unload-hook | ||
| 1419 | (lambda () | ||
| 1420 | (unload-feature 'tramp-gvfs 'force))) | ||
| 1421 | |||
| 1406 | (provide 'tramp-gvfs) | 1422 | (provide 'tramp-gvfs) |
| 1407 | 1423 | ||
| 1408 | ;;; TODO: | 1424 | ;;; TODO: |
diff --git a/lisp/net/tramp-gw.el b/lisp/net/tramp-gw.el index 76f9b30f90c..63dfd105f1c 100644 --- a/lisp/net/tramp-gw.el +++ b/lisp/net/tramp-gw.el | |||
| @@ -38,11 +38,6 @@ | |||
| 38 | (require 'cl) | 38 | (require 'cl) |
| 39 | (require 'custom)) | 39 | (require 'custom)) |
| 40 | 40 | ||
| 41 | ;; Autoload the socks library. It is used only when we access a SOCKS server. | ||
| 42 | (autoload 'socks-open-network-stream "socks") | ||
| 43 | (defvar socks-username (user-login-name)) | ||
| 44 | (defvar socks-server (list "Default server" "socks" 1080 5)) | ||
| 45 | |||
| 46 | ;; Avoid byte-compiler warnings if the byte-compiler supports this. | 41 | ;; Avoid byte-compiler warnings if the byte-compiler supports this. |
| 47 | ;; Currently, XEmacs supports this. | 42 | ;; Currently, XEmacs supports this. |
| 48 | (eval-when-compile | 43 | (eval-when-compile |
| @@ -50,21 +45,29 @@ | |||
| 50 | (byte-compiler-options (warnings (- unused-vars))))) | 45 | (byte-compiler-options (warnings (- unused-vars))))) |
| 51 | 46 | ||
| 52 | ;; Define HTTP tunnel method ... | 47 | ;; Define HTTP tunnel method ... |
| 53 | (defvar tramp-gw-tunnel-method "tunnel" | 48 | ;;;###tramp-autoload |
| 49 | (defconst tramp-gw-tunnel-method "tunnel" | ||
| 54 | "*Method to connect HTTP gateways.") | 50 | "*Method to connect HTTP gateways.") |
| 55 | 51 | ||
| 56 | ;; ... and port. | 52 | ;; ... and port. |
| 57 | (defvar tramp-gw-default-tunnel-port 8080 | 53 | (defconst tramp-gw-default-tunnel-port 8080 |
| 58 | "*Default port for HTTP gateways.") | 54 | "*Default port for HTTP gateways.") |
| 59 | 55 | ||
| 60 | ;; Define SOCKS method ... | 56 | ;; Define SOCKS method ... |
| 61 | (defvar tramp-gw-socks-method "socks" | 57 | ;;;###tramp-autoload |
| 58 | (defconst tramp-gw-socks-method "socks" | ||
| 62 | "*Method to connect SOCKS servers.") | 59 | "*Method to connect SOCKS servers.") |
| 63 | 60 | ||
| 64 | ;; ... and port. | 61 | ;; ... and port. |
| 65 | (defvar tramp-gw-default-socks-port 1080 | 62 | (defconst tramp-gw-default-socks-port 1080 |
| 66 | "*Default port for SOCKS servers.") | 63 | "*Default port for SOCKS servers.") |
| 67 | 64 | ||
| 65 | ;; Autoload the socks library. It is used only when we access a SOCKS server. | ||
| 66 | (autoload 'socks-open-network-stream "socks") | ||
| 67 | (defvar socks-username (user-login-name)) | ||
| 68 | (defvar socks-server | ||
| 69 | (list "Default server" "socks" tramp-gw-default-socks-port 5)) | ||
| 70 | |||
| 68 | ;; Add a default for `tramp-default-user-alist'. Default is the local user. | 71 | ;; Add a default for `tramp-default-user-alist'. Default is the local user. |
| 69 | (add-to-list 'tramp-default-user-alist | 72 | (add-to-list 'tramp-default-user-alist |
| 70 | `(,tramp-gw-tunnel-method nil ,(user-login-name))) | 73 | `(,tramp-gw-tunnel-method nil ,(user-login-name))) |
| @@ -125,6 +128,7 @@ | |||
| 125 | (process-send-string | 128 | (process-send-string |
| 126 | (tramp-get-connection-property proc "process" nil) string))) | 129 | (tramp-get-connection-property proc "process" nil) string))) |
| 127 | 130 | ||
| 131 | ;;;###tramp-autoload | ||
| 128 | (defun tramp-gw-open-connection (vec gw-vec target-vec) | 132 | (defun tramp-gw-open-connection (vec gw-vec target-vec) |
| 129 | "Open a remote connection to VEC (see `tramp-file-name' structure). | 133 | "Open a remote connection to VEC (see `tramp-file-name' structure). |
| 130 | Take GW-VEC as SOCKS or HTTP gateway, i.e. its method must be a | 134 | Take GW-VEC as SOCKS or HTTP gateway, i.e. its method must be a |
| @@ -310,6 +314,9 @@ password in password cache. This is done for the first try only." | |||
| 310 | (format | 314 | (format |
| 311 | "Password for %s@[%s]: " socks-username (read (current-buffer))))))))) | 315 | "Password for %s@[%s]: " socks-username (read (current-buffer))))))))) |
| 312 | 316 | ||
| 317 | (add-hook 'tramp-unload-hook | ||
| 318 | (lambda () | ||
| 319 | (unload-feature 'tramp-gw 'force))) | ||
| 313 | 320 | ||
| 314 | (provide 'tramp-gw) | 321 | (provide 'tramp-gw) |
| 315 | 322 | ||
diff --git a/lisp/net/tramp-imap.el b/lisp/net/tramp-imap.el index 55addf588a7..4a5e2418cfb 100644 --- a/lisp/net/tramp-imap.el +++ b/lisp/net/tramp-imap.el | |||
| @@ -55,7 +55,6 @@ | |||
| 55 | 55 | ||
| 56 | (require 'assoc) | 56 | (require 'assoc) |
| 57 | (require 'tramp) | 57 | (require 'tramp) |
| 58 | (require 'tramp-compat) | ||
| 59 | 58 | ||
| 60 | (autoload 'auth-source-user-or-password "auth-source") | 59 | (autoload 'auth-source-user-or-password "auth-source") |
| 61 | (autoload 'epg-context-operation "epg") | 60 | (autoload 'epg-context-operation "epg") |
| @@ -76,21 +75,29 @@ | |||
| 76 | '(add-to-list 'imap-hash-headers 'X-Size 'append)) | 75 | '(add-to-list 'imap-hash-headers 'X-Size 'append)) |
| 77 | 76 | ||
| 78 | ;; Define Tramp IMAP method ... | 77 | ;; Define Tramp IMAP method ... |
| 78 | ;;;###tramp-autoload | ||
| 79 | (defconst tramp-imap-method "imap" | 79 | (defconst tramp-imap-method "imap" |
| 80 | "*Method to connect via IMAP protocol.") | 80 | "*Method to connect via IMAP protocol.") |
| 81 | 81 | ||
| 82 | (add-to-list 'tramp-methods (list tramp-imap-method '(tramp-default-port 143))) | 82 | ;;;###tramp-autoload |
| 83 | (when (and (locate-library "epa") (locate-library "imap-hash")) | ||
| 84 | (add-to-list 'tramp-methods | ||
| 85 | (list tramp-imap-method '(tramp-default-port 143)))) | ||
| 83 | 86 | ||
| 84 | ;; Add a default for `tramp-default-user-alist'. Default is the local user. | 87 | ;; Add a default for `tramp-default-user-alist'. Default is the local user. |
| 85 | (add-to-list 'tramp-default-user-alist | 88 | (add-to-list 'tramp-default-user-alist |
| 86 | `(,tramp-imap-method nil ,(user-login-name))) | 89 | `(,tramp-imap-method nil ,(user-login-name))) |
| 87 | 90 | ||
| 88 | ;; Define Tramp IMAPS method ... | 91 | ;; Define Tramp IMAPS method ... |
| 92 | ;;;###tramp-autoload | ||
| 89 | (defconst tramp-imaps-method "imaps" | 93 | (defconst tramp-imaps-method "imaps" |
| 90 | "*Method to connect via secure IMAP protocol.") | 94 | "*Method to connect via secure IMAP protocol.") |
| 91 | 95 | ||
| 92 | ;; ... and add it to the method list. | 96 | ;; ... and add it to the method list. |
| 93 | (add-to-list 'tramp-methods (list tramp-imaps-method '(tramp-default-port 993))) | 97 | ;;;###tramp-autoload |
| 98 | (when (and (locate-library "epa") (locate-library "imap-hash")) | ||
| 99 | (add-to-list 'tramp-methods | ||
| 100 | (list tramp-imaps-method '(tramp-default-port 993)))) | ||
| 94 | 101 | ||
| 95 | ;; Add a default for `tramp-default-user-alist'. Default is the local user. | 102 | ;; Add a default for `tramp-default-user-alist'. Default is the local user. |
| 96 | (add-to-list 'tramp-default-user-alist | 103 | (add-to-list 'tramp-default-user-alist |
| @@ -184,13 +191,15 @@ Operations not mentioned here will be handled by the default Emacs primitives.") | |||
| 184 | (defvar tramp-imap-passphrase-cache nil) ;; can be t or 'never | 191 | (defvar tramp-imap-passphrase-cache nil) ;; can be t or 'never |
| 185 | (defvar tramp-imap-passphrase nil) | 192 | (defvar tramp-imap-passphrase nil) |
| 186 | 193 | ||
| 187 | (defun tramp-imap-file-name-p (filename) | 194 | ;;;###tramp-autoload |
| 195 | (defsubst tramp-imap-file-name-p (filename) | ||
| 188 | "Check if it's a filename for IMAP protocol." | 196 | "Check if it's a filename for IMAP protocol." |
| 189 | (let ((v (tramp-dissect-file-name filename))) | 197 | (let ((v (tramp-dissect-file-name filename))) |
| 190 | (or | 198 | (or |
| 191 | (string= (tramp-file-name-method v) tramp-imap-method) | 199 | (string= (tramp-file-name-method v) tramp-imap-method) |
| 192 | (string= (tramp-file-name-method v) tramp-imaps-method)))) | 200 | (string= (tramp-file-name-method v) tramp-imaps-method)))) |
| 193 | 201 | ||
| 202 | ;;;###tramp-autoload | ||
| 194 | (defun tramp-imap-file-name-handler (operation &rest args) | 203 | (defun tramp-imap-file-name-handler (operation &rest args) |
| 195 | "Invoke the IMAP related OPERATION. | 204 | "Invoke the IMAP related OPERATION. |
| 196 | First arg specifies the OPERATION, second arg is a list of arguments to | 205 | First arg specifies the OPERATION, second arg is a list of arguments to |
| @@ -200,8 +209,10 @@ pass to the OPERATION." | |||
| 200 | (save-match-data (apply (cdr fn) args)) | 209 | (save-match-data (apply (cdr fn) args)) |
| 201 | (tramp-run-real-handler operation args)))) | 210 | (tramp-run-real-handler operation args)))) |
| 202 | 211 | ||
| 203 | (add-to-list 'tramp-foreign-file-name-handler-alist | 212 | ;;;###tramp-autoload |
| 204 | (cons 'tramp-imap-file-name-p 'tramp-imap-file-name-handler)) | 213 | (when (and (locate-library "epa") (locate-library "imap-hash")) |
| 214 | (add-to-list 'tramp-foreign-file-name-handler-alist | ||
| 215 | (cons 'tramp-imap-file-name-p 'tramp-imap-file-name-handler))) | ||
| 205 | 216 | ||
| 206 | (defun tramp-imap-handle-copy-file | 217 | (defun tramp-imap-handle-copy-file |
| 207 | (filename newname &optional ok-if-already-exists keep-date | 218 | (filename newname &optional ok-if-already-exists keep-date |
| @@ -776,6 +787,10 @@ With NEEDED-SUBJECT, alters the imap-hash test accordingly." | |||
| 776 | tramp-imap-subject-marker | 787 | tramp-imap-subject-marker |
| 777 | (if needed-subject needed-subject ""))))) | 788 | (if needed-subject needed-subject ""))))) |
| 778 | 789 | ||
| 790 | (add-hook 'tramp-unload-hook | ||
| 791 | (lambda () | ||
| 792 | (unload-feature 'tramp-imap 'force))) | ||
| 793 | |||
| 779 | ;;; TODO: | 794 | ;;; TODO: |
| 780 | 795 | ||
| 781 | ;; * Implement `tramp-imap-handle-delete-directory', | 796 | ;; * Implement `tramp-imap-handle-delete-directory', |
diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el index 48af7d8120a..84d11972115 100644 --- a/lisp/net/tramp-smb.el +++ b/lisp/net/tramp-smb.el | |||
| @@ -30,17 +30,16 @@ | |||
| 30 | 30 | ||
| 31 | (eval-when-compile (require 'cl)) ; block, return | 31 | (eval-when-compile (require 'cl)) ; block, return |
| 32 | (require 'tramp) | 32 | (require 'tramp) |
| 33 | (require 'tramp-cache) | ||
| 34 | (require 'tramp-compat) | ||
| 35 | 33 | ||
| 36 | ;; Define SMB method ... | 34 | ;; Define SMB method ... |
| 37 | (defcustom tramp-smb-method "smb" | 35 | ;;;###tramp-autoload |
| 38 | "*Method to connect SAMBA and M$ SMB servers." | 36 | (defconst tramp-smb-method "smb" |
| 39 | :group 'tramp | 37 | "*Method to connect SAMBA and M$ SMB servers.") |
| 40 | :type 'string) | ||
| 41 | 38 | ||
| 42 | ;; ... and add it to the method list. | 39 | ;; ... and add it to the method list. |
| 43 | (add-to-list 'tramp-methods (cons tramp-smb-method nil)) | 40 | ;;;###tramp-autoload |
| 41 | (unless (memq system-type '(cygwin windows-nt)) | ||
| 42 | (add-to-list 'tramp-methods (cons tramp-smb-method nil))) | ||
| 44 | 43 | ||
| 45 | ;; Add a default for `tramp-default-method-alist'. Rule: If there is | 44 | ;; Add a default for `tramp-default-method-alist'. Rule: If there is |
| 46 | ;; a domain in USER, it must be the SMB method. | 45 | ;; a domain in USER, it must be the SMB method. |
| @@ -205,11 +204,13 @@ See `tramp-actions-before-shell' for more info.") | |||
| 205 | "Alist of handler functions for Tramp SMB method. | 204 | "Alist of handler functions for Tramp SMB method. |
| 206 | Operations not mentioned here will be handled by the default Emacs primitives.") | 205 | Operations not mentioned here will be handled by the default Emacs primitives.") |
| 207 | 206 | ||
| 208 | (defun tramp-smb-file-name-p (filename) | 207 | ;;;###tramp-autoload |
| 208 | (defsubst tramp-smb-file-name-p (filename) | ||
| 209 | "Check if it's a filename for SMB servers." | 209 | "Check if it's a filename for SMB servers." |
| 210 | (let ((v (tramp-dissect-file-name filename))) | 210 | (let ((v (tramp-dissect-file-name filename))) |
| 211 | (string= (tramp-file-name-method v) tramp-smb-method))) | 211 | (string= (tramp-file-name-method v) tramp-smb-method))) |
| 212 | 212 | ||
| 213 | ;;;###tramp-autoload | ||
| 213 | (defun tramp-smb-file-name-handler (operation &rest args) | 214 | (defun tramp-smb-file-name-handler (operation &rest args) |
| 214 | "Invoke the SMB related OPERATION. | 215 | "Invoke the SMB related OPERATION. |
| 215 | First arg specifies the OPERATION, second arg is a list of arguments to | 216 | First arg specifies the OPERATION, second arg is a list of arguments to |
| @@ -219,8 +220,10 @@ pass to the OPERATION." | |||
| 219 | (save-match-data (apply (cdr fn) args)) | 220 | (save-match-data (apply (cdr fn) args)) |
| 220 | (tramp-run-real-handler operation args)))) | 221 | (tramp-run-real-handler operation args)))) |
| 221 | 222 | ||
| 222 | (add-to-list 'tramp-foreign-file-name-handler-alist | 223 | ;;;###tramp-autoload |
| 223 | (cons 'tramp-smb-file-name-p 'tramp-smb-file-name-handler)) | 224 | (unless (memq system-type '(cygwin windows-nt)) |
| 225 | (add-to-list 'tramp-foreign-file-name-handler-alist | ||
| 226 | (cons 'tramp-smb-file-name-p 'tramp-smb-file-name-handler))) | ||
| 224 | 227 | ||
| 225 | 228 | ||
| 226 | ;; File name primitives. | 229 | ;; File name primitives. |
| @@ -784,7 +787,7 @@ PRESERVE-UID-GID is completely ignored." | |||
| 784 | (if (tramp-smb-get-cifs-capabilities v) | 787 | (if (tramp-smb-get-cifs-capabilities v) |
| 785 | (format | 788 | (format |
| 786 | "posix_mkdir \"%s\" %s" | 789 | "posix_mkdir \"%s\" %s" |
| 787 | file (tramp-decimal-to-octal (default-file-modes))) | 790 | file (tramp-compat-decimal-to-octal (default-file-modes))) |
| 788 | (format "mkdir \"%s\"" file))) | 791 | (format "mkdir \"%s\"" file))) |
| 789 | ;; We must also flush the cache of the directory, because | 792 | ;; We must also flush the cache of the directory, because |
| 790 | ;; `file-attributes' reads the values from there. | 793 | ;; `file-attributes' reads the values from there. |
| @@ -893,7 +896,7 @@ target of the symlink differ." | |||
| 893 | (unless (tramp-smb-send-command | 896 | (unless (tramp-smb-send-command |
| 894 | v (format "chmod \"%s\" %s" | 897 | v (format "chmod \"%s\" %s" |
| 895 | (tramp-smb-get-localname v) | 898 | (tramp-smb-get-localname v) |
| 896 | (tramp-decimal-to-octal mode))) | 899 | (tramp-compat-decimal-to-octal mode))) |
| 897 | (tramp-error | 900 | (tramp-error |
| 898 | v 'file-error "Error while changing file's mode %s" filename))))) | 901 | v 'file-error "Error while changing file's mode %s" filename))))) |
| 899 | 902 | ||
| @@ -1397,6 +1400,9 @@ Returns nil if an error message has appeared." | |||
| 1397 | (tramp-message vec 6 "\n%s" (buffer-string)) | 1400 | (tramp-message vec 6 "\n%s" (buffer-string)) |
| 1398 | (not err)))) | 1401 | (not err)))) |
| 1399 | 1402 | ||
| 1403 | (add-hook 'tramp-unload-hook | ||
| 1404 | (lambda () | ||
| 1405 | (unload-feature 'tramp-smb 'force))) | ||
| 1400 | 1406 | ||
| 1401 | (provide 'tramp-smb) | 1407 | (provide 'tramp-smb) |
| 1402 | 1408 | ||
diff --git a/lisp/net/tramp-uu.el b/lisp/net/tramp-uu.el index a9f816be815..fe6862c9240 100644 --- a/lisp/net/tramp-uu.el +++ b/lisp/net/tramp-uu.el | |||
| @@ -50,6 +50,7 @@ | |||
| 50 | "Return the byte that is encoded as CHAR." | 50 | "Return the byte that is encoded as CHAR." |
| 51 | (cdr (assq char tramp-uu-b64-char-to-byte))) | 51 | (cdr (assq char tramp-uu-b64-char-to-byte))) |
| 52 | 52 | ||
| 53 | ;;;###tramp-autoload | ||
| 53 | (defun tramp-uuencode-region (beg end) | 54 | (defun tramp-uuencode-region (beg end) |
| 54 | "UU-encode the region between BEG and END." | 55 | "UU-encode the region between BEG and END." |
| 55 | ;; First we base64 encode the region, then we transmogrify that into | 56 | ;; First we base64 encode the region, then we transmogrify that into |
| @@ -87,6 +88,10 @@ | |||
| 87 | (goto-char beg) | 88 | (goto-char beg) |
| 88 | (insert "begin 600 xxx\n")))) | 89 | (insert "begin 600 xxx\n")))) |
| 89 | 90 | ||
| 91 | (add-hook 'tramp-unload-hook | ||
| 92 | (lambda () | ||
| 93 | (unload-feature 'tramp-uu 'force))) | ||
| 94 | |||
| 90 | (provide 'tramp-uu) | 95 | (provide 'tramp-uu) |
| 91 | 96 | ||
| 92 | ;; arch-tag: 7153f2c6-8be5-4cd2-8c06-0fbcf5190ef6 | 97 | ;; arch-tag: 7153f2c6-8be5-4cd2-8c06-0fbcf5190ef6 |
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index d5d1606c617..cddfd44c13b 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el | |||
| @@ -8,6 +8,7 @@ | |||
| 8 | ;; Author: Kai Großjohann <kai.grossjohann@gmx.net> | 8 | ;; Author: Kai Großjohann <kai.grossjohann@gmx.net> |
| 9 | ;; Michael Albinus <michael.albinus@gmx.de> | 9 | ;; Michael Albinus <michael.albinus@gmx.de> |
| 10 | ;; Keywords: comm, processes | 10 | ;; Keywords: comm, processes |
| 11 | ;; Package: tramp | ||
| 11 | 12 | ||
| 12 | ;; This file is part of GNU Emacs. | 13 | ;; This file is part of GNU Emacs. |
| 13 | 14 | ||
| @@ -66,18 +67,7 @@ | |||
| 66 | (when (and load-in-progress (null (current-message))) | 67 | (when (and load-in-progress (null (current-message))) |
| 67 | (message "Loading tramp...")) | 68 | (message "Loading tramp...")) |
| 68 | 69 | ||
| 69 | ;; The Tramp version number and bug report address, as prepared by configure. | ||
| 70 | (require 'trampver) | ||
| 71 | (add-hook 'tramp-unload-hook | ||
| 72 | (lambda () | ||
| 73 | (when (featurep 'trampver) | ||
| 74 | (unload-feature 'trampver 'force)))) | ||
| 75 | |||
| 76 | (require 'tramp-compat) | 70 | (require 'tramp-compat) |
| 77 | (add-hook 'tramp-unload-hook | ||
| 78 | (lambda () | ||
| 79 | (when (featurep 'tramp-compat) | ||
| 80 | (unload-feature 'tramp-compat 'force)))) | ||
| 81 | 71 | ||
| 82 | (require 'format-spec) | 72 | (require 'format-spec) |
| 83 | ;; As long as password.el is not part of (X)Emacs, it shouldn't | 73 | ;; As long as password.el is not part of (X)Emacs, it shouldn't |
| @@ -95,82 +85,8 @@ | |||
| 95 | (load "auth-source" 'noerror) | 85 | (load "auth-source" 'noerror) |
| 96 | (require 'auth-source nil 'noerror))) | 86 | (require 'auth-source nil 'noerror))) |
| 97 | 87 | ||
| 98 | ;; Requiring 'tramp-cache results in an endless loop. | ||
| 99 | (autoload 'tramp-get-file-property "tramp-cache") | ||
| 100 | (autoload 'tramp-set-file-property "tramp-cache") | ||
| 101 | (autoload 'tramp-flush-file-property "tramp-cache") | ||
| 102 | (autoload 'tramp-flush-directory-property "tramp-cache") | ||
| 103 | (autoload 'tramp-get-connection-property "tramp-cache") | ||
| 104 | (autoload 'tramp-set-connection-property "tramp-cache") | ||
| 105 | (autoload 'tramp-flush-connection-property "tramp-cache") | ||
| 106 | (autoload 'tramp-parse-connection-properties "tramp-cache") | ||
| 107 | (add-hook 'tramp-unload-hook | ||
| 108 | (lambda () | ||
| 109 | (when (featurep 'tramp-cache) | ||
| 110 | (unload-feature 'tramp-cache 'force)))) | ||
| 111 | |||
| 112 | (autoload 'tramp-uuencode-region "tramp-uu" | ||
| 113 | "Implementation of `uuencode' in Lisp.") | ||
| 114 | (add-hook 'tramp-unload-hook | ||
| 115 | (lambda () | ||
| 116 | (when (featurep 'tramp-uu) | ||
| 117 | (unload-feature 'tramp-uu 'force)))) | ||
| 118 | |||
| 119 | (autoload 'uudecode-decode-region "uudecode") | 88 | (autoload 'uudecode-decode-region "uudecode") |
| 120 | 89 | ||
| 121 | ;; The following Tramp packages must be loaded after tramp.el, because | ||
| 122 | ;; they require it as well. | ||
| 123 | (eval-after-load "tramp" | ||
| 124 | '(dolist | ||
| 125 | (feature | ||
| 126 | (list | ||
| 127 | |||
| 128 | ;; Tramp interactive commands. | ||
| 129 | 'tramp-cmds | ||
| 130 | |||
| 131 | ;; Load foreign FTP method. | ||
| 132 | (if (featurep 'xemacs) 'tramp-efs 'tramp-ftp) | ||
| 133 | |||
| 134 | ;; tramp-smb uses "smbclient" from Samba. Not available | ||
| 135 | ;; under Cygwin and Windows, because they don't offer | ||
| 136 | ;; "smbclient". And even not necessary there, because Emacs | ||
| 137 | ;; supports UNC file names like "//host/share/localname". | ||
| 138 | (unless (memq system-type '(cygwin windows-nt)) 'tramp-smb) | ||
| 139 | |||
| 140 | ;; Load foreign FISH method. | ||
| 141 | 'tramp-fish | ||
| 142 | |||
| 143 | ;; tramp-gvfs needs D-Bus messages. Available since Emacs 23 | ||
| 144 | ;; on some system types. We don't call `dbus-ping', because | ||
| 145 | ;; this would load dbus.el. | ||
| 146 | (when (and (featurep 'dbusbind) | ||
| 147 | (condition-case nil | ||
| 148 | (tramp-compat-funcall 'dbus-get-unique-name :session) | ||
| 149 | (error nil)) | ||
| 150 | (tramp-compat-process-running-p "gvfs-fuse-daemon")) | ||
| 151 | 'tramp-gvfs) | ||
| 152 | |||
| 153 | ;; Load gateways. It needs `make-network-process' from Emacs 22. | ||
| 154 | (when (functionp 'make-network-process) 'tramp-gw) | ||
| 155 | |||
| 156 | ;; tramp-imap needs both epa (from Emacs 23.1) and imap-hash | ||
| 157 | ;; (from Emacs 23.2). | ||
| 158 | (when (and (locate-library "epa") (locate-library "imap-hash")) | ||
| 159 | 'tramp-imap))) | ||
| 160 | |||
| 161 | (when feature | ||
| 162 | ;; We have used just some basic tests, whether a package shall | ||
| 163 | ;; be added. There might still be other errors during loading, | ||
| 164 | ;; which we will catch here. | ||
| 165 | (catch 'tramp-loading | ||
| 166 | (require feature) | ||
| 167 | (add-hook 'tramp-unload-hook | ||
| 168 | `(lambda () | ||
| 169 | (when (featurep (quote ,feature)) | ||
| 170 | (unload-feature (quote ,feature) 'force))))) | ||
| 171 | (unless (featurep feature) | ||
| 172 | (message "Loading %s failed, ignoring this package" feature))))) | ||
| 173 | |||
| 174 | ;;; User Customizable Internal Variables: | 90 | ;;; User Customizable Internal Variables: |
| 175 | 91 | ||
| 176 | (defgroup tramp nil | 92 | (defgroup tramp nil |
| @@ -300,6 +216,7 @@ If it is nil, inline out-of-the-band copy will be used without a check." | |||
| 300 | :group 'tramp | 216 | :group 'tramp |
| 301 | :type '(choice (const nil) integer)) | 217 | :type '(choice (const nil) integer)) |
| 302 | 218 | ||
| 219 | ;;;###tramp-autoload | ||
| 303 | (defcustom tramp-terminal-type "dumb" | 220 | (defcustom tramp-terminal-type "dumb" |
| 304 | "*Value of TERM environment variable for logging in to remote host. | 221 | "*Value of TERM environment variable for logging in to remote host. |
| 305 | Because Tramp wants to parse the output of the remote shell, it is easily | 222 | Because Tramp wants to parse the output of the remote shell, it is easily |
| @@ -320,9 +237,11 @@ files conditionalize this setup based on the TERM environment variable." | |||
| 320 | The '$' character at the end is quoted; the string cannot be | 237 | The '$' character at the end is quoted; the string cannot be |
| 321 | detected as prompt when being sent on echoing hosts, therefore.") | 238 | detected as prompt when being sent on echoing hosts, therefore.") |
| 322 | 239 | ||
| 240 | ;;;###tramp-autoload | ||
| 323 | (defconst tramp-initial-end-of-output "#$ " | 241 | (defconst tramp-initial-end-of-output "#$ " |
| 324 | "Prompt when establishing a connection.") | 242 | "Prompt when establishing a connection.") |
| 325 | 243 | ||
| 244 | ;;;###tramp-autoload | ||
| 326 | (defvar tramp-methods | 245 | (defvar tramp-methods |
| 327 | `(("rcp" (tramp-login-program "rsh") | 246 | `(("rcp" (tramp-login-program "rsh") |
| 328 | (tramp-login-args (("%h") ("-l" "%u"))) | 247 | (tramp-login-args (("%h") ("-l" "%u"))) |
| @@ -2097,6 +2016,7 @@ mentioned here will be handled by `tramp-file-name-handler-alist' or the | |||
| 2097 | normal Emacs functions.") | 2016 | normal Emacs functions.") |
| 2098 | 2017 | ||
| 2099 | ;; Handlers for foreign methods, like FTP or SMB, shall be plugged here. | 2018 | ;; Handlers for foreign methods, like FTP or SMB, shall be plugged here. |
| 2019 | ;;;###tramp-autoload | ||
| 2100 | (defvar tramp-foreign-file-name-handler-alist | 2020 | (defvar tramp-foreign-file-name-handler-alist |
| 2101 | ;; (identity . tramp-sh-file-name-handler) should always be the last | 2021 | ;; (identity . tramp-sh-file-name-handler) should always be the last |
| 2102 | ;; entry, because `identity' always matches. | 2022 | ;; entry, because `identity' always matches. |
| @@ -2107,6 +2027,257 @@ calling HANDLER.") | |||
| 2107 | 2027 | ||
| 2108 | ;;; Internal functions which must come first: | 2028 | ;;; Internal functions which must come first: |
| 2109 | 2029 | ||
| 2030 | |||
| 2031 | ;; ------------------------------------------------------------ | ||
| 2032 | ;; -- Tramp file names -- | ||
| 2033 | ;; ------------------------------------------------------------ | ||
| 2034 | ;; Conversion functions between external representation and | ||
| 2035 | ;; internal data structure. Convenience functions for internal | ||
| 2036 | ;; data structure. | ||
| 2037 | |||
| 2038 | (defun tramp-file-name-p (vec) | ||
| 2039 | "Check, whether VEC is a Tramp object." | ||
| 2040 | (and (vectorp vec) (= 4 (length vec)))) | ||
| 2041 | |||
| 2042 | (defun tramp-file-name-method (vec) | ||
| 2043 | "Return method component of VEC." | ||
| 2044 | (and (tramp-file-name-p vec) (aref vec 0))) | ||
| 2045 | |||
| 2046 | (defun tramp-file-name-user (vec) | ||
| 2047 | "Return user component of VEC." | ||
| 2048 | (and (tramp-file-name-p vec) (aref vec 1))) | ||
| 2049 | |||
| 2050 | (defun tramp-file-name-host (vec) | ||
| 2051 | "Return host component of VEC." | ||
| 2052 | (and (tramp-file-name-p vec) (aref vec 2))) | ||
| 2053 | |||
| 2054 | (defun tramp-file-name-localname (vec) | ||
| 2055 | "Return localname component of VEC." | ||
| 2056 | (and (tramp-file-name-p vec) (aref vec 3))) | ||
| 2057 | |||
| 2058 | ;; The user part of a Tramp file name vector can be of kind | ||
| 2059 | ;; "user%domain". Sometimes, we must extract these parts. | ||
| 2060 | (defun tramp-file-name-real-user (vec) | ||
| 2061 | "Return the user name of VEC without domain." | ||
| 2062 | (save-match-data | ||
| 2063 | (let ((user (tramp-file-name-user vec))) | ||
| 2064 | (if (and (stringp user) | ||
| 2065 | (string-match tramp-user-with-domain-regexp user)) | ||
| 2066 | (match-string 1 user) | ||
| 2067 | user)))) | ||
| 2068 | |||
| 2069 | (defun tramp-file-name-domain (vec) | ||
| 2070 | "Return the domain name of VEC." | ||
| 2071 | (save-match-data | ||
| 2072 | (let ((user (tramp-file-name-user vec))) | ||
| 2073 | (and (stringp user) | ||
| 2074 | (string-match tramp-user-with-domain-regexp user) | ||
| 2075 | (match-string 2 user))))) | ||
| 2076 | |||
| 2077 | ;; The host part of a Tramp file name vector can be of kind | ||
| 2078 | ;; "host#port". Sometimes, we must extract these parts. | ||
| 2079 | (defun tramp-file-name-real-host (vec) | ||
| 2080 | "Return the host name of VEC without port." | ||
| 2081 | (save-match-data | ||
| 2082 | (let ((host (tramp-file-name-host vec))) | ||
| 2083 | (if (and (stringp host) | ||
| 2084 | (string-match tramp-host-with-port-regexp host)) | ||
| 2085 | (match-string 1 host) | ||
| 2086 | host)))) | ||
| 2087 | |||
| 2088 | (defun tramp-file-name-port (vec) | ||
| 2089 | "Return the port number of VEC." | ||
| 2090 | (save-match-data | ||
| 2091 | (let ((host (tramp-file-name-host vec))) | ||
| 2092 | (and (stringp host) | ||
| 2093 | (string-match tramp-host-with-port-regexp host) | ||
| 2094 | (string-to-number (match-string 2 host)))))) | ||
| 2095 | |||
| 2096 | ;;;###tramp-autoload | ||
| 2097 | (defun tramp-tramp-file-p (name) | ||
| 2098 | "Return t if NAME is a string with Tramp file name syntax." | ||
| 2099 | (save-match-data | ||
| 2100 | (and (stringp name) (string-match tramp-file-name-regexp name)))) | ||
| 2101 | |||
| 2102 | (defun tramp-find-method (method user host) | ||
| 2103 | "Return the right method string to use. | ||
| 2104 | This is METHOD, if non-nil. Otherwise, do a lookup in | ||
| 2105 | `tramp-default-method-alist'." | ||
| 2106 | (or method | ||
| 2107 | (let ((choices tramp-default-method-alist) | ||
| 2108 | lmethod item) | ||
| 2109 | (while choices | ||
| 2110 | (setq item (pop choices)) | ||
| 2111 | (when (and (string-match (or (nth 0 item) "") (or host "")) | ||
| 2112 | (string-match (or (nth 1 item) "") (or user ""))) | ||
| 2113 | (setq lmethod (nth 2 item)) | ||
| 2114 | (setq choices nil))) | ||
| 2115 | lmethod) | ||
| 2116 | tramp-default-method)) | ||
| 2117 | |||
| 2118 | (defun tramp-find-user (method user host) | ||
| 2119 | "Return the right user string to use. | ||
| 2120 | This is USER, if non-nil. Otherwise, do a lookup in | ||
| 2121 | `tramp-default-user-alist'." | ||
| 2122 | (or user | ||
| 2123 | (let ((choices tramp-default-user-alist) | ||
| 2124 | luser item) | ||
| 2125 | (while choices | ||
| 2126 | (setq item (pop choices)) | ||
| 2127 | (when (and (string-match (or (nth 0 item) "") (or method "")) | ||
| 2128 | (string-match (or (nth 1 item) "") (or host ""))) | ||
| 2129 | (setq luser (nth 2 item)) | ||
| 2130 | (setq choices nil))) | ||
| 2131 | luser) | ||
| 2132 | tramp-default-user)) | ||
| 2133 | |||
| 2134 | (defun tramp-find-host (method user host) | ||
| 2135 | "Return the right host string to use. | ||
| 2136 | This is HOST, if non-nil. Otherwise, it is `tramp-default-host'." | ||
| 2137 | (or (and (> (length host) 0) host) | ||
| 2138 | tramp-default-host)) | ||
| 2139 | |||
| 2140 | (defun tramp-dissect-file-name (name &optional nodefault) | ||
| 2141 | "Return a `tramp-file-name' structure. | ||
| 2142 | The structure consists of remote method, remote user, remote host | ||
| 2143 | and localname (file name on remote host). If NODEFAULT is | ||
| 2144 | non-nil, the file name parts are not expanded to their default | ||
| 2145 | values." | ||
| 2146 | (save-match-data | ||
| 2147 | (let ((match (string-match (nth 0 tramp-file-name-structure) name))) | ||
| 2148 | (unless match (error "Not a Tramp file name: %s" name)) | ||
| 2149 | (let ((method (match-string (nth 1 tramp-file-name-structure) name)) | ||
| 2150 | (user (match-string (nth 2 tramp-file-name-structure) name)) | ||
| 2151 | (host (match-string (nth 3 tramp-file-name-structure) name)) | ||
| 2152 | (localname (match-string (nth 4 tramp-file-name-structure) name))) | ||
| 2153 | (when (member method '("multi" "multiu")) | ||
| 2154 | (error | ||
| 2155 | "`%s' method is no longer supported, see (info \"(tramp)Multi-hops\")" | ||
| 2156 | method)) | ||
| 2157 | (when host | ||
| 2158 | (when (string-match tramp-prefix-ipv6-regexp host) | ||
| 2159 | (setq host (replace-match "" nil t host))) | ||
| 2160 | (when (string-match tramp-postfix-ipv6-regexp host) | ||
| 2161 | (setq host (replace-match "" nil t host)))) | ||
| 2162 | (if nodefault | ||
| 2163 | (vector method user host localname) | ||
| 2164 | (vector | ||
| 2165 | (tramp-find-method method user host) | ||
| 2166 | (tramp-find-user method user host) | ||
| 2167 | (tramp-find-host method user host) | ||
| 2168 | localname)))))) | ||
| 2169 | |||
| 2170 | (defun tramp-buffer-name (vec) | ||
| 2171 | "A name for the connection buffer VEC." | ||
| 2172 | ;; We must use `tramp-file-name-real-host', because for gateway | ||
| 2173 | ;; methods the default port will be expanded later on, which would | ||
| 2174 | ;; tamper the name. | ||
| 2175 | (let ((method (tramp-file-name-method vec)) | ||
| 2176 | (user (tramp-file-name-user vec)) | ||
| 2177 | (host (tramp-file-name-real-host vec))) | ||
| 2178 | (if (not (zerop (length user))) | ||
| 2179 | (format "*tramp/%s %s@%s*" method user host) | ||
| 2180 | (format "*tramp/%s %s*" method host)))) | ||
| 2181 | |||
| 2182 | (defun tramp-make-tramp-file-name (method user host localname) | ||
| 2183 | "Constructs a Tramp file name from METHOD, USER, HOST and LOCALNAME." | ||
| 2184 | (concat tramp-prefix-format | ||
| 2185 | (when (not (zerop (length method))) | ||
| 2186 | (concat method tramp-postfix-method-format)) | ||
| 2187 | (when (not (zerop (length user))) | ||
| 2188 | (concat user tramp-postfix-user-format)) | ||
| 2189 | (when host | ||
| 2190 | (if (string-match tramp-ipv6-regexp host) | ||
| 2191 | (concat tramp-prefix-ipv6-format host tramp-postfix-ipv6-format) | ||
| 2192 | host)) | ||
| 2193 | tramp-postfix-host-format | ||
| 2194 | (when localname localname))) | ||
| 2195 | |||
| 2196 | (defun tramp-completion-make-tramp-file-name (method user host localname) | ||
| 2197 | "Constructs a Tramp file name from METHOD, USER, HOST and LOCALNAME. | ||
| 2198 | It must not be a complete Tramp file name, but as long as there are | ||
| 2199 | necessary only. This function will be used in file name completion." | ||
| 2200 | (concat tramp-prefix-format | ||
| 2201 | (when (not (zerop (length method))) | ||
| 2202 | (concat method tramp-postfix-method-format)) | ||
| 2203 | (when (not (zerop (length user))) | ||
| 2204 | (concat user tramp-postfix-user-format)) | ||
| 2205 | (when (not (zerop (length host))) | ||
| 2206 | (concat | ||
| 2207 | (if (string-match tramp-ipv6-regexp host) | ||
| 2208 | (concat tramp-prefix-ipv6-format host tramp-postfix-ipv6-format) | ||
| 2209 | host) | ||
| 2210 | tramp-postfix-host-format)) | ||
| 2211 | (when localname localname))) | ||
| 2212 | |||
| 2213 | (defun tramp-get-buffer (vec) | ||
| 2214 | "Get the connection buffer to be used for VEC." | ||
| 2215 | (or (get-buffer (tramp-buffer-name vec)) | ||
| 2216 | (with-current-buffer (get-buffer-create (tramp-buffer-name vec)) | ||
| 2217 | (setq buffer-undo-list t) | ||
| 2218 | (setq default-directory | ||
| 2219 | (tramp-make-tramp-file-name | ||
| 2220 | (tramp-file-name-method vec) | ||
| 2221 | (tramp-file-name-user vec) | ||
| 2222 | (tramp-file-name-host vec) | ||
| 2223 | "/")) | ||
| 2224 | (current-buffer)))) | ||
| 2225 | |||
| 2226 | (defun tramp-get-connection-buffer (vec) | ||
| 2227 | "Get the connection buffer to be used for VEC. | ||
| 2228 | In case a second asynchronous communication has been started, it is different | ||
| 2229 | from `tramp-get-buffer'." | ||
| 2230 | (or (tramp-get-connection-property vec "process-buffer" nil) | ||
| 2231 | (tramp-get-buffer vec))) | ||
| 2232 | |||
| 2233 | (defun tramp-get-connection-process (vec) | ||
| 2234 | "Get the connection process to be used for VEC. | ||
| 2235 | In case a second asynchronous communication has been started, it is different | ||
| 2236 | from the default one." | ||
| 2237 | (get-process | ||
| 2238 | (or (tramp-get-connection-property vec "process-name" nil) | ||
| 2239 | (tramp-buffer-name vec)))) | ||
| 2240 | |||
| 2241 | (defun tramp-debug-buffer-name (vec) | ||
| 2242 | "A name for the debug buffer for VEC." | ||
| 2243 | ;; We must use `tramp-file-name-real-host', because for gateway | ||
| 2244 | ;; methods the default port will be expanded later on, which would | ||
| 2245 | ;; tamper the name. | ||
| 2246 | (let ((method (tramp-file-name-method vec)) | ||
| 2247 | (user (tramp-file-name-user vec)) | ||
| 2248 | (host (tramp-file-name-real-host vec))) | ||
| 2249 | (if (not (zerop (length user))) | ||
| 2250 | (format "*debug tramp/%s %s@%s*" method user host) | ||
| 2251 | (format "*debug tramp/%s %s*" method host)))) | ||
| 2252 | |||
| 2253 | (defconst tramp-debug-outline-regexp | ||
| 2254 | "[0-9]+:[0-9]+:[0-9]+\\.[0-9]+ [a-z0-9-]+ (\\([0-9]+\\)) #") | ||
| 2255 | |||
| 2256 | (defun tramp-get-debug-buffer (vec) | ||
| 2257 | "Get the debug buffer for VEC." | ||
| 2258 | (with-current-buffer | ||
| 2259 | (get-buffer-create (tramp-debug-buffer-name vec)) | ||
| 2260 | (when (bobp) | ||
| 2261 | (setq buffer-undo-list t) | ||
| 2262 | ;; Activate `outline-mode'. This runs `text-mode-hook' and | ||
| 2263 | ;; `outline-mode-hook'. We must prevent that local processes | ||
| 2264 | ;; die. Yes: I've seen `flyspell-mode', which starts "ispell". | ||
| 2265 | ;; Furthermore, `outline-regexp' must have the correct value | ||
| 2266 | ;; already, because it is used by `font-lock-compile-keywords'. | ||
| 2267 | (let ((default-directory (tramp-compat-temporary-file-directory)) | ||
| 2268 | (outline-regexp tramp-debug-outline-regexp)) | ||
| 2269 | (outline-mode)) | ||
| 2270 | (set (make-local-variable 'outline-regexp) tramp-debug-outline-regexp) | ||
| 2271 | (set (make-local-variable 'outline-level) 'tramp-outline-level)) | ||
| 2272 | (current-buffer))) | ||
| 2273 | |||
| 2274 | (defun tramp-outline-level () | ||
| 2275 | "Return the depth to which a statement is nested in the outline. | ||
| 2276 | Point must be at the beginning of a header line. | ||
| 2277 | |||
| 2278 | The outline level is equal to the verbosity of the Tramp message." | ||
| 2279 | (1+ (string-to-number (match-string 1)))) | ||
| 2280 | |||
| 2110 | (defsubst tramp-debug-message (vec fmt-string &rest args) | 2281 | (defsubst tramp-debug-message (vec fmt-string &rest args) |
| 2111 | "Append message to debug buffer. | 2282 | "Append message to debug buffer. |
| 2112 | Message is formatted with FMT-STRING as control string and the remaining | 2283 | Message is formatted with FMT-STRING as control string and the remaining |
| @@ -2266,39 +2437,6 @@ If VAR is nil, then we bind `v' to the structure and `method', `user', | |||
| 2266 | (put 'with-parsed-tramp-file-name 'edebug-form-spec '(form symbolp body)) | 2437 | (put 'with-parsed-tramp-file-name 'edebug-form-spec '(form symbolp body)) |
| 2267 | (font-lock-add-keywords 'emacs-lisp-mode '("\\<with-parsed-tramp-file-name\\>")) | 2438 | (font-lock-add-keywords 'emacs-lisp-mode '("\\<with-parsed-tramp-file-name\\>")) |
| 2268 | 2439 | ||
| 2269 | (defmacro with-file-property (vec file property &rest body) | ||
| 2270 | "Check in Tramp cache for PROPERTY, otherwise execute BODY and set cache. | ||
| 2271 | FILE must be a local file name on a connection identified via VEC." | ||
| 2272 | `(if (file-name-absolute-p ,file) | ||
| 2273 | (let ((value (tramp-get-file-property ,vec ,file ,property 'undef))) | ||
| 2274 | (when (eq value 'undef) | ||
| 2275 | ;; We cannot pass @body as parameter to | ||
| 2276 | ;; `tramp-set-file-property' because it mangles our | ||
| 2277 | ;; debug messages. | ||
| 2278 | (setq value (progn ,@body)) | ||
| 2279 | (tramp-set-file-property ,vec ,file ,property value)) | ||
| 2280 | value) | ||
| 2281 | ,@body)) | ||
| 2282 | |||
| 2283 | (put 'with-file-property 'lisp-indent-function 3) | ||
| 2284 | (put 'with-file-property 'edebug-form-spec t) | ||
| 2285 | (font-lock-add-keywords 'emacs-lisp-mode '("\\<with-file-property\\>")) | ||
| 2286 | |||
| 2287 | (defmacro with-connection-property (key property &rest body) | ||
| 2288 | "Check in Tramp for property PROPERTY, otherwise executes BODY and set." | ||
| 2289 | `(let ((value (tramp-get-connection-property ,key ,property 'undef))) | ||
| 2290 | (when (eq value 'undef) | ||
| 2291 | ;; We cannot pass ,@body as parameter to | ||
| 2292 | ;; `tramp-set-connection-property' because it mangles our debug | ||
| 2293 | ;; messages. | ||
| 2294 | (setq value (progn ,@body)) | ||
| 2295 | (tramp-set-connection-property ,key ,property value)) | ||
| 2296 | value)) | ||
| 2297 | |||
| 2298 | (put 'with-connection-property 'lisp-indent-function 2) | ||
| 2299 | (put 'with-connection-property 'edebug-form-spec t) | ||
| 2300 | (font-lock-add-keywords 'emacs-lisp-mode '("\\<with-connection-property\\>")) | ||
| 2301 | |||
| 2302 | (defun tramp-progress-reporter-update (reporter &optional value) | 2440 | (defun tramp-progress-reporter-update (reporter &optional value) |
| 2303 | (let* ((parameters (cdr reporter)) | 2441 | (let* ((parameters (cdr reporter)) |
| 2304 | (message (aref parameters 3))) | 2442 | (message (aref parameters 3))) |
| @@ -2374,7 +2512,7 @@ Return the local name of the temporary file." | |||
| 2374 | (setq result nil) | 2512 | (setq result nil) |
| 2375 | ;; This creates the file by side effect. | 2513 | ;; This creates the file by side effect. |
| 2376 | (set-file-times result) | 2514 | (set-file-times result) |
| 2377 | (set-file-modes result (tramp-octal-to-decimal "0700")))) | 2515 | (set-file-modes result (tramp-compat-octal-to-decimal "0700")))) |
| 2378 | 2516 | ||
| 2379 | ;; Return the local part. | 2517 | ;; Return the local part. |
| 2380 | (with-parsed-tramp-file-name result nil localname))) | 2518 | (with-parsed-tramp-file-name result nil localname))) |
| @@ -2414,7 +2552,7 @@ Example: | |||
| 2414 | ;; Windows registry. | 2552 | ;; Windows registry. |
| 2415 | (and (memq system-type '(cygwin windows-nt)) | 2553 | (and (memq system-type '(cygwin windows-nt)) |
| 2416 | (zerop | 2554 | (zerop |
| 2417 | (tramp-local-call-process | 2555 | (tramp-compat-call-process |
| 2418 | "reg" nil nil nil "query" (nth 1 (car v))))) | 2556 | "reg" nil nil nil "query" (nth 1 (car v))))) |
| 2419 | ;; Configuration file. | 2557 | ;; Configuration file. |
| 2420 | (file-exists-p (nth 1 (car v))))) | 2558 | (file-exists-p (nth 1 (car v))))) |
| @@ -3026,7 +3164,7 @@ of." | |||
| 3026 | (unless (zerop (tramp-send-command-and-check | 3164 | (unless (zerop (tramp-send-command-and-check |
| 3027 | v | 3165 | v |
| 3028 | (format "chmod %s %s" | 3166 | (format "chmod %s %s" |
| 3029 | (tramp-decimal-to-octal mode) | 3167 | (tramp-compat-decimal-to-octal mode) |
| 3030 | (tramp-shell-quote-argument localname)))) | 3168 | (tramp-shell-quote-argument localname)))) |
| 3031 | ;; FIXME: extract the proper text from chmod's stderr. | 3169 | ;; FIXME: extract the proper text from chmod's stderr. |
| 3032 | (tramp-error | 3170 | (tramp-error |
| @@ -3057,7 +3195,7 @@ of." | |||
| 3057 | ;; We handle also the local part, because in older Emacsen, | 3195 | ;; We handle also the local part, because in older Emacsen, |
| 3058 | ;; without `set-file-times', this function is an alias for this. | 3196 | ;; without `set-file-times', this function is an alias for this. |
| 3059 | ;; We are local, so we don't need the UTC settings. | 3197 | ;; We are local, so we don't need the UTC settings. |
| 3060 | (tramp-local-call-process | 3198 | (tramp-compat-call-process |
| 3061 | "touch" nil nil nil "-t" | 3199 | "touch" nil nil nil "-t" |
| 3062 | (format-time-string "%Y%m%d%H%M.%S" time) | 3200 | (format-time-string "%Y%m%d%H%M.%S" time) |
| 3063 | (tramp-shell-quote-argument filename))))) | 3201 | (tramp-shell-quote-argument filename))))) |
| @@ -3090,7 +3228,7 @@ and gid of the corresponding user is taken. Both parameters must be integers." | |||
| 3090 | ;; `set-file-uid-gid'. On W32 "chown" might not work. | 3228 | ;; `set-file-uid-gid'. On W32 "chown" might not work. |
| 3091 | (let ((uid (or (and (integerp uid) uid) (tramp-get-local-uid 'integer))) | 3229 | (let ((uid (or (and (integerp uid) uid) (tramp-get-local-uid 'integer))) |
| 3092 | (gid (or (and (integerp gid) gid) (tramp-get-local-gid 'integer)))) | 3230 | (gid (or (and (integerp gid) gid) (tramp-get-local-gid 'integer)))) |
| 3093 | (tramp-local-call-process | 3231 | (tramp-compat-call-process |
| 3094 | "chown" nil nil nil | 3232 | "chown" nil nil nil |
| 3095 | (format "%d:%d" uid gid) (tramp-shell-quote-argument filename)))))) | 3233 | (format "%d:%d" uid gid) (tramp-shell-quote-argument filename)))))) |
| 3096 | 3234 | ||
| @@ -3218,7 +3356,7 @@ and gid of the corresponding user is taken. Both parameters must be integers." | |||
| 3218 | If the file modes of FILENAME cannot be determined, return the | 3356 | If the file modes of FILENAME cannot be determined, return the |
| 3219 | value of `default-file-modes', without execute permissions." | 3357 | value of `default-file-modes', without execute permissions." |
| 3220 | (or (file-modes filename) | 3358 | (or (file-modes filename) |
| 3221 | (logand (default-file-modes) (tramp-octal-to-decimal "0666")))) | 3359 | (logand (default-file-modes) (tramp-compat-octal-to-decimal "0666")))) |
| 3222 | 3360 | ||
| 3223 | (defun tramp-handle-file-directory-p (filename) | 3361 | (defun tramp-handle-file-directory-p (filename) |
| 3224 | "Like `file-directory-p' for Tramp files." | 3362 | "Like `file-directory-p' for Tramp files." |
| @@ -3905,7 +4043,8 @@ the uid and gid from FILENAME." | |||
| 3905 | ;; Since this does not work reliable, we also | 4043 | ;; Since this does not work reliable, we also |
| 3906 | ;; give read permissions. | 4044 | ;; give read permissions. |
| 3907 | (set-file-modes | 4045 | (set-file-modes |
| 3908 | (concat prefix tmpfile) (tramp-octal-to-decimal "0777")) | 4046 | (concat prefix tmpfile) |
| 4047 | (tramp-compat-octal-to-decimal "0777")) | ||
| 3909 | (tramp-set-file-uid-gid | 4048 | (tramp-set-file-uid-gid |
| 3910 | (concat prefix tmpfile) | 4049 | (concat prefix tmpfile) |
| 3911 | (tramp-get-local-uid 'integer) | 4050 | (tramp-get-local-uid 'integer) |
| @@ -3921,7 +4060,8 @@ the uid and gid from FILENAME." | |||
| 3921 | ;; We must change the ownership as local user. | 4060 | ;; We must change the ownership as local user. |
| 3922 | ;; Since this does not work reliable, we also | 4061 | ;; Since this does not work reliable, we also |
| 3923 | ;; give read permissions. | 4062 | ;; give read permissions. |
| 3924 | (set-file-modes tmpfile (tramp-octal-to-decimal "0777")) | 4063 | (set-file-modes |
| 4064 | tmpfile (tramp-compat-octal-to-decimal "0777")) | ||
| 3925 | (tramp-set-file-uid-gid | 4065 | (tramp-set-file-uid-gid |
| 3926 | tmpfile | 4066 | tmpfile |
| 3927 | (tramp-get-remote-uid v 'integer) | 4067 | (tramp-get-remote-uid v 'integer) |
| @@ -4689,20 +4829,6 @@ beginning of local filename are not substituted." | |||
| 4689 | (keyboard-quit) | 4829 | (keyboard-quit) |
| 4690 | ret)))) | 4830 | ret)))) |
| 4691 | 4831 | ||
| 4692 | (defun tramp-local-call-process | ||
| 4693 | (program &optional infile destination display &rest args) | ||
| 4694 | "Calls `call-process' on the local host. | ||
| 4695 | This is needed because for some Emacs flavors Tramp has | ||
| 4696 | defadviced `call-process' to behave like `process-file'. The | ||
| 4697 | Lisp error raised when PROGRAM is nil is trapped also, returning 1." | ||
| 4698 | (let ((default-directory | ||
| 4699 | (if (file-remote-p default-directory) | ||
| 4700 | (tramp-compat-temporary-file-directory) | ||
| 4701 | default-directory))) | ||
| 4702 | (if (executable-find program) | ||
| 4703 | (apply 'call-process program infile destination display args) | ||
| 4704 | 1))) | ||
| 4705 | |||
| 4706 | (defun tramp-handle-call-process-region | 4832 | (defun tramp-handle-call-process-region |
| 4707 | (start end program &optional delete buffer display &rest args) | 4833 | (start end program &optional delete buffer display &rest args) |
| 4708 | "Like `call-process-region' for Tramp files." | 4834 | "Like `call-process-region' for Tramp files." |
| @@ -4772,7 +4898,7 @@ Lisp error raised when PROGRAM is nil is trapped also, returning 1." | |||
| 4772 | ;; Display output. | 4898 | ;; Display output. |
| 4773 | (pop-to-buffer output-buffer) | 4899 | (pop-to-buffer output-buffer) |
| 4774 | (setq mode-line-process '(":%s")) | 4900 | (setq mode-line-process '(":%s")) |
| 4775 | (require 'shell) (shell-mode)) | 4901 | (shell-mode)) |
| 4776 | 4902 | ||
| 4777 | (prog1 | 4903 | (prog1 |
| 4778 | ;; Run the process. | 4904 | ;; Run the process. |
| @@ -4981,7 +5107,7 @@ coding system might not be determined. This function repairs it." | |||
| 4981 | ;; When the file is not readable for the owner, it | 5107 | ;; When the file is not readable for the owner, it |
| 4982 | ;; cannot be inserted, even it is redable for the group | 5108 | ;; cannot be inserted, even it is redable for the group |
| 4983 | ;; or for everybody. | 5109 | ;; or for everybody. |
| 4984 | (set-file-modes local-copy (tramp-octal-to-decimal "0600")) | 5110 | (set-file-modes local-copy (tramp-compat-octal-to-decimal "0600")) |
| 4985 | 5111 | ||
| 4986 | (when (and (null remote-copy) | 5112 | (when (and (null remote-copy) |
| 4987 | (tramp-get-method-parameter | 5113 | (tramp-get-method-parameter |
| @@ -5219,7 +5345,8 @@ Returns a file name in `tramp-auto-save-directory' for autosaving this file." | |||
| 5219 | ;; Ensure, that it is still readable. | 5345 | ;; Ensure, that it is still readable. |
| 5220 | (when modes | 5346 | (when modes |
| 5221 | (set-file-modes | 5347 | (set-file-modes |
| 5222 | tmpfile (logior (or modes 0) (tramp-octal-to-decimal "0400")))) | 5348 | tmpfile |
| 5349 | (logior (or modes 0) (tramp-compat-octal-to-decimal "0400")))) | ||
| 5223 | 5350 | ||
| 5224 | ;; This is a bit lengthy due to the different methods | 5351 | ;; This is a bit lengthy due to the different methods |
| 5225 | ;; possible for file transfer. First, we check whether the | 5352 | ;; possible for file transfer. First, we check whether the |
| @@ -5318,7 +5445,7 @@ Returns a file name in `tramp-auto-save-directory' for autosaving this file." | |||
| 5318 | (erase-buffer) | 5445 | (erase-buffer) |
| 5319 | (and | 5446 | (and |
| 5320 | ;; cksum runs locally, if possible. | 5447 | ;; cksum runs locally, if possible. |
| 5321 | (zerop (tramp-local-call-process "cksum" tmpfile t)) | 5448 | (zerop (tramp-compat-call-process "cksum" tmpfile t)) |
| 5322 | ;; cksum runs remotely. | 5449 | ;; cksum runs remotely. |
| 5323 | (zerop | 5450 | (zerop |
| 5324 | (tramp-send-command-and-check | 5451 | (tramp-send-command-and-check |
| @@ -5795,6 +5922,7 @@ should never be set globally, the intention is to let-bind it.") | |||
| 5795 | ;; Tramp file name syntax. Maybe another variable should be introduced | 5922 | ;; Tramp file name syntax. Maybe another variable should be introduced |
| 5796 | ;; overwriting this check in such cases. Or we change Tramp file name | 5923 | ;; overwriting this check in such cases. Or we change Tramp file name |
| 5797 | ;; syntax in order to avoid ambiguities, like in XEmacs ... | 5924 | ;; syntax in order to avoid ambiguities, like in XEmacs ... |
| 5925 | ;;;###tramp-autoload | ||
| 5798 | (defun tramp-completion-mode-p () | 5926 | (defun tramp-completion-mode-p () |
| 5799 | "Check, whether method / user name / host name completion is active." | 5927 | "Check, whether method / user name / host name completion is active." |
| 5800 | (or | 5928 | (or |
| @@ -6344,7 +6472,7 @@ User is always nil." | |||
| 6344 | (let ((default-directory (tramp-compat-temporary-file-directory)) | 6472 | (let ((default-directory (tramp-compat-temporary-file-directory)) |
| 6345 | res) | 6473 | res) |
| 6346 | (with-temp-buffer | 6474 | (with-temp-buffer |
| 6347 | (when (zerop (tramp-local-call-process "reg" nil t nil "query" registry)) | 6475 | (when (zerop (tramp-compat-call-process "reg" nil t nil "query" registry)) |
| 6348 | (goto-char (point-min)) | 6476 | (goto-char (point-min)) |
| 6349 | (while (not (eobp)) | 6477 | (while (not (eobp)) |
| 6350 | (push (tramp-parse-putty-group registry) res)))) | 6478 | (push (tramp-parse-putty-group registry) res)))) |
| @@ -6419,18 +6547,6 @@ hosts, or files, disagree." | |||
| 6419 | (tramp-shell-quote-argument v1-localname) | 6547 | (tramp-shell-quote-argument v1-localname) |
| 6420 | (tramp-shell-quote-argument v2-localname)))))) | 6548 | (tramp-shell-quote-argument v2-localname)))))) |
| 6421 | 6549 | ||
| 6422 | (defun tramp-buffer-name (vec) | ||
| 6423 | "A name for the connection buffer VEC." | ||
| 6424 | ;; We must use `tramp-file-name-real-host', because for gateway | ||
| 6425 | ;; methods the default port will be expanded later on, which would | ||
| 6426 | ;; tamper the name. | ||
| 6427 | (let ((method (tramp-file-name-method vec)) | ||
| 6428 | (user (tramp-file-name-user vec)) | ||
| 6429 | (host (tramp-file-name-real-host vec))) | ||
| 6430 | (if (not (zerop (length user))) | ||
| 6431 | (format "*tramp/%s %s@%s*" method user host) | ||
| 6432 | (format "*tramp/%s %s*" method host)))) | ||
| 6433 | |||
| 6434 | (defun tramp-delete-temp-file-function () | 6550 | (defun tramp-delete-temp-file-function () |
| 6435 | "Remove temporary files related to current buffer." | 6551 | "Remove temporary files related to current buffer." |
| 6436 | (when (stringp tramp-temp-buffer-file-name) | 6552 | (when (stringp tramp-temp-buffer-file-name) |
| @@ -6444,74 +6560,6 @@ hosts, or files, disagree." | |||
| 6444 | (remove-hook 'kill-buffer-hook | 6560 | (remove-hook 'kill-buffer-hook |
| 6445 | 'tramp-delete-temp-file-function))) | 6561 | 'tramp-delete-temp-file-function))) |
| 6446 | 6562 | ||
| 6447 | (defun tramp-get-buffer (vec) | ||
| 6448 | "Get the connection buffer to be used for VEC." | ||
| 6449 | (or (get-buffer (tramp-buffer-name vec)) | ||
| 6450 | (with-current-buffer (get-buffer-create (tramp-buffer-name vec)) | ||
| 6451 | (setq buffer-undo-list t) | ||
| 6452 | (setq default-directory | ||
| 6453 | (tramp-make-tramp-file-name | ||
| 6454 | (tramp-file-name-method vec) | ||
| 6455 | (tramp-file-name-user vec) | ||
| 6456 | (tramp-file-name-host vec) | ||
| 6457 | "/")) | ||
| 6458 | (current-buffer)))) | ||
| 6459 | |||
| 6460 | (defun tramp-get-connection-buffer (vec) | ||
| 6461 | "Get the connection buffer to be used for VEC. | ||
| 6462 | In case a second asynchronous communication has been started, it is different | ||
| 6463 | from `tramp-get-buffer'." | ||
| 6464 | (or (tramp-get-connection-property vec "process-buffer" nil) | ||
| 6465 | (tramp-get-buffer vec))) | ||
| 6466 | |||
| 6467 | (defun tramp-get-connection-process (vec) | ||
| 6468 | "Get the connection process to be used for VEC. | ||
| 6469 | In case a second asynchronous communication has been started, it is different | ||
| 6470 | from the default one." | ||
| 6471 | (get-process | ||
| 6472 | (or (tramp-get-connection-property vec "process-name" nil) | ||
| 6473 | (tramp-buffer-name vec)))) | ||
| 6474 | |||
| 6475 | (defun tramp-debug-buffer-name (vec) | ||
| 6476 | "A name for the debug buffer for VEC." | ||
| 6477 | ;; We must use `tramp-file-name-real-host', because for gateway | ||
| 6478 | ;; methods the default port will be expanded later on, which would | ||
| 6479 | ;; tamper the name. | ||
| 6480 | (let ((method (tramp-file-name-method vec)) | ||
| 6481 | (user (tramp-file-name-user vec)) | ||
| 6482 | (host (tramp-file-name-real-host vec))) | ||
| 6483 | (if (not (zerop (length user))) | ||
| 6484 | (format "*debug tramp/%s %s@%s*" method user host) | ||
| 6485 | (format "*debug tramp/%s %s*" method host)))) | ||
| 6486 | |||
| 6487 | (defconst tramp-debug-outline-regexp | ||
| 6488 | "[0-9]+:[0-9]+:[0-9]+\\.[0-9]+ [a-z0-9-]+ (\\([0-9]+\\)) #") | ||
| 6489 | |||
| 6490 | (defun tramp-get-debug-buffer (vec) | ||
| 6491 | "Get the debug buffer for VEC." | ||
| 6492 | (with-current-buffer | ||
| 6493 | (get-buffer-create (tramp-debug-buffer-name vec)) | ||
| 6494 | (when (bobp) | ||
| 6495 | (setq buffer-undo-list t) | ||
| 6496 | ;; Activate `outline-mode'. This runs `text-mode-hook' and | ||
| 6497 | ;; `outline-mode-hook'. We must prevent that local processes | ||
| 6498 | ;; die. Yes: I've seen `flyspell-mode', which starts "ispell". | ||
| 6499 | ;; Furthermore, `outline-regexp' must have the correct value | ||
| 6500 | ;; already, because it is used by `font-lock-compile-keywords'. | ||
| 6501 | (let ((default-directory (tramp-compat-temporary-file-directory)) | ||
| 6502 | (outline-regexp tramp-debug-outline-regexp)) | ||
| 6503 | (outline-mode)) | ||
| 6504 | (set (make-local-variable 'outline-regexp) tramp-debug-outline-regexp) | ||
| 6505 | (set (make-local-variable 'outline-level) 'tramp-outline-level)) | ||
| 6506 | (current-buffer))) | ||
| 6507 | |||
| 6508 | (defun tramp-outline-level () | ||
| 6509 | "Return the depth to which a statement is nested in the outline. | ||
| 6510 | Point must be at the beginning of a header line. | ||
| 6511 | |||
| 6512 | The outline level is equal to the verbosity of the Tramp message." | ||
| 6513 | (1+ (string-to-number (match-string 1)))) | ||
| 6514 | |||
| 6515 | (defun tramp-find-executable | 6563 | (defun tramp-find-executable |
| 6516 | (vec progname dirlist &optional ignore-tilde ignore-path) | 6564 | (vec progname dirlist &optional ignore-tilde ignore-path) |
| 6517 | "Searches for PROGNAME in $PATH and all directories mentioned in DIRLIST. | 6565 | "Searches for PROGNAME in $PATH and all directories mentioned in DIRLIST. |
| @@ -7294,7 +7342,7 @@ INPUT can also be nil which means `/dev/null'. | |||
| 7294 | OUTPUT can be a string (which specifies a filename), or t (which | 7342 | OUTPUT can be a string (which specifies a filename), or t (which |
| 7295 | means standard output and thus the current buffer), or nil (which | 7343 | means standard output and thus the current buffer), or nil (which |
| 7296 | means discard it)." | 7344 | means discard it)." |
| 7297 | (tramp-local-call-process | 7345 | (tramp-compat-call-process |
| 7298 | tramp-encoding-shell | 7346 | tramp-encoding-shell |
| 7299 | (when (and input (not (string-match "%s" cmd))) input) | 7347 | (when (and input (not (string-match "%s" cmd))) input) |
| 7300 | (if (eq output t) t nil) | 7348 | (if (eq output t) t nil) |
| @@ -7397,12 +7445,10 @@ Gateway hops are already opened." | |||
| 7397 | (setq choices tramp-default-proxies-alist))))) | 7445 | (setq choices tramp-default-proxies-alist))))) |
| 7398 | 7446 | ||
| 7399 | ;; Handle gateways. | 7447 | ;; Handle gateways. |
| 7400 | (when (and (boundp 'tramp-gw-tunnel-method) | 7448 | (when (string-match |
| 7401 | (string-match (format | 7449 | (format |
| 7402 | "^\\(%s\\|%s\\)$" | 7450 | "^\\(%s\\|%s\\)$" tramp-gw-tunnel-method tramp-gw-socks-method) |
| 7403 | (symbol-value 'tramp-gw-tunnel-method) | 7451 | (tramp-file-name-method (car target-alist))) |
| 7404 | (symbol-value 'tramp-gw-socks-method)) | ||
| 7405 | (tramp-file-name-method (car target-alist)))) | ||
| 7406 | (let ((gw (pop target-alist)) | 7452 | (let ((gw (pop target-alist)) |
| 7407 | (hop (pop target-alist))) | 7453 | (hop (pop target-alist))) |
| 7408 | ;; Is the method prepared for gateways? | 7454 | ;; Is the method prepared for gateways? |
| @@ -7699,6 +7745,7 @@ function waits for output unless NOOUTPUT is set." | |||
| 7699 | ;; Return value is whether end-of-output sentinel was found. | 7745 | ;; Return value is whether end-of-output sentinel was found. |
| 7700 | found))) | 7746 | found))) |
| 7701 | 7747 | ||
| 7748 | ;;;###tramp-autoload | ||
| 7702 | (defun tramp-send-command-and-check | 7749 | (defun tramp-send-command-and-check |
| 7703 | (vec command &optional subshell dont-suppress-err) | 7750 | (vec command &optional subshell dont-suppress-err) |
| 7704 | "Run COMMAND and check its exit status. | 7751 | "Run COMMAND and check its exit status. |
| @@ -7807,57 +7854,57 @@ the remote host use line-endings as defined in the variable | |||
| 7807 | (save-match-data | 7854 | (save-match-data |
| 7808 | (logior | 7855 | (logior |
| 7809 | (cond | 7856 | (cond |
| 7810 | ((char-equal owner-read ?r) (tramp-octal-to-decimal "00400")) | 7857 | ((char-equal owner-read ?r) (tramp-compat-octal-to-decimal "00400")) |
| 7811 | ((char-equal owner-read ?-) 0) | 7858 | ((char-equal owner-read ?-) 0) |
| 7812 | (t (error "Second char `%c' must be one of `r-'" owner-read))) | 7859 | (t (error "Second char `%c' must be one of `r-'" owner-read))) |
| 7813 | (cond | 7860 | (cond |
| 7814 | ((char-equal owner-write ?w) (tramp-octal-to-decimal "00200")) | 7861 | ((char-equal owner-write ?w) (tramp-compat-octal-to-decimal "00200")) |
| 7815 | ((char-equal owner-write ?-) 0) | 7862 | ((char-equal owner-write ?-) 0) |
| 7816 | (t (error "Third char `%c' must be one of `w-'" owner-write))) | 7863 | (t (error "Third char `%c' must be one of `w-'" owner-write))) |
| 7817 | (cond | 7864 | (cond |
| 7818 | ((char-equal owner-execute-or-setid ?x) | 7865 | ((char-equal owner-execute-or-setid ?x) |
| 7819 | (tramp-octal-to-decimal "00100")) | 7866 | (tramp-compat-octal-to-decimal "00100")) |
| 7820 | ((char-equal owner-execute-or-setid ?S) | 7867 | ((char-equal owner-execute-or-setid ?S) |
| 7821 | (tramp-octal-to-decimal "04000")) | 7868 | (tramp-compat-octal-to-decimal "04000")) |
| 7822 | ((char-equal owner-execute-or-setid ?s) | 7869 | ((char-equal owner-execute-or-setid ?s) |
| 7823 | (tramp-octal-to-decimal "04100")) | 7870 | (tramp-compat-octal-to-decimal "04100")) |
| 7824 | ((char-equal owner-execute-or-setid ?-) 0) | 7871 | ((char-equal owner-execute-or-setid ?-) 0) |
| 7825 | (t (error "Fourth char `%c' must be one of `xsS-'" | 7872 | (t (error "Fourth char `%c' must be one of `xsS-'" |
| 7826 | owner-execute-or-setid))) | 7873 | owner-execute-or-setid))) |
| 7827 | (cond | 7874 | (cond |
| 7828 | ((char-equal group-read ?r) (tramp-octal-to-decimal "00040")) | 7875 | ((char-equal group-read ?r) (tramp-compat-octal-to-decimal "00040")) |
| 7829 | ((char-equal group-read ?-) 0) | 7876 | ((char-equal group-read ?-) 0) |
| 7830 | (t (error "Fifth char `%c' must be one of `r-'" group-read))) | 7877 | (t (error "Fifth char `%c' must be one of `r-'" group-read))) |
| 7831 | (cond | 7878 | (cond |
| 7832 | ((char-equal group-write ?w) (tramp-octal-to-decimal "00020")) | 7879 | ((char-equal group-write ?w) (tramp-compat-octal-to-decimal "00020")) |
| 7833 | ((char-equal group-write ?-) 0) | 7880 | ((char-equal group-write ?-) 0) |
| 7834 | (t (error "Sixth char `%c' must be one of `w-'" group-write))) | 7881 | (t (error "Sixth char `%c' must be one of `w-'" group-write))) |
| 7835 | (cond | 7882 | (cond |
| 7836 | ((char-equal group-execute-or-setid ?x) | 7883 | ((char-equal group-execute-or-setid ?x) |
| 7837 | (tramp-octal-to-decimal "00010")) | 7884 | (tramp-compat-octal-to-decimal "00010")) |
| 7838 | ((char-equal group-execute-or-setid ?S) | 7885 | ((char-equal group-execute-or-setid ?S) |
| 7839 | (tramp-octal-to-decimal "02000")) | 7886 | (tramp-compat-octal-to-decimal "02000")) |
| 7840 | ((char-equal group-execute-or-setid ?s) | 7887 | ((char-equal group-execute-or-setid ?s) |
| 7841 | (tramp-octal-to-decimal "02010")) | 7888 | (tramp-compat-octal-to-decimal "02010")) |
| 7842 | ((char-equal group-execute-or-setid ?-) 0) | 7889 | ((char-equal group-execute-or-setid ?-) 0) |
| 7843 | (t (error "Seventh char `%c' must be one of `xsS-'" | 7890 | (t (error "Seventh char `%c' must be one of `xsS-'" |
| 7844 | group-execute-or-setid))) | 7891 | group-execute-or-setid))) |
| 7845 | (cond | 7892 | (cond |
| 7846 | ((char-equal other-read ?r) | 7893 | ((char-equal other-read ?r) |
| 7847 | (tramp-octal-to-decimal "00004")) | 7894 | (tramp-compat-octal-to-decimal "00004")) |
| 7848 | ((char-equal other-read ?-) 0) | 7895 | ((char-equal other-read ?-) 0) |
| 7849 | (t (error "Eighth char `%c' must be one of `r-'" other-read))) | 7896 | (t (error "Eighth char `%c' must be one of `r-'" other-read))) |
| 7850 | (cond | 7897 | (cond |
| 7851 | ((char-equal other-write ?w) (tramp-octal-to-decimal "00002")) | 7898 | ((char-equal other-write ?w) (tramp-compat-octal-to-decimal "00002")) |
| 7852 | ((char-equal other-write ?-) 0) | 7899 | ((char-equal other-write ?-) 0) |
| 7853 | (t (error "Nineth char `%c' must be one of `w-'" other-write))) | 7900 | (t (error "Nineth char `%c' must be one of `w-'" other-write))) |
| 7854 | (cond | 7901 | (cond |
| 7855 | ((char-equal other-execute-or-sticky ?x) | 7902 | ((char-equal other-execute-or-sticky ?x) |
| 7856 | (tramp-octal-to-decimal "00001")) | 7903 | (tramp-compat-octal-to-decimal "00001")) |
| 7857 | ((char-equal other-execute-or-sticky ?T) | 7904 | ((char-equal other-execute-or-sticky ?T) |
| 7858 | (tramp-octal-to-decimal "01000")) | 7905 | (tramp-compat-octal-to-decimal "01000")) |
| 7859 | ((char-equal other-execute-or-sticky ?t) | 7906 | ((char-equal other-execute-or-sticky ?t) |
| 7860 | (tramp-octal-to-decimal "01001")) | 7907 | (tramp-compat-octal-to-decimal "01001")) |
| 7861 | ((char-equal other-execute-or-sticky ?-) 0) | 7908 | ((char-equal other-execute-or-sticky ?-) 0) |
| 7862 | (t (error "Tenth char `%c' must be one of `xtT-'" | 7909 | (t (error "Tenth char `%c' must be one of `xtT-'" |
| 7863 | other-execute-or-sticky))))))) | 7910 | other-execute-or-sticky))))))) |
| @@ -8018,24 +8065,6 @@ This is used internally by `tramp-file-mode-from-int'." | |||
| 8018 | (and suid (upcase suid-text)) ; suid, !execute | 8065 | (and suid (upcase suid-text)) ; suid, !execute |
| 8019 | (and x "x") "-")))) ; !suid | 8066 | (and x "x") "-")))) ; !suid |
| 8020 | 8067 | ||
| 8021 | (defun tramp-decimal-to-octal (i) | ||
| 8022 | "Return a string consisting of the octal digits of I. | ||
| 8023 | Not actually used. Use `(format \"%o\" i)' instead?" | ||
| 8024 | (cond ((< i 0) (error "Cannot convert negative number to octal")) | ||
| 8025 | ((not (integerp i)) (error "Cannot convert non-integer to octal")) | ||
| 8026 | ((zerop i) "0") | ||
| 8027 | (t (concat (tramp-decimal-to-octal (/ i 8)) | ||
| 8028 | (number-to-string (% i 8)))))) | ||
| 8029 | |||
| 8030 | ;; Kudos to Gerd Moellmann for this suggestion. | ||
| 8031 | (defun tramp-octal-to-decimal (ostr) | ||
| 8032 | "Given a string of octal digits, return a decimal number." | ||
| 8033 | (let ((x (or ostr ""))) | ||
| 8034 | ;; `save-match' is in `tramp-mode-string-to-int' which calls this. | ||
| 8035 | (unless (string-match "\\`[0-7]*\\'" x) | ||
| 8036 | (error "Non-octal junk in string `%s'" x)) | ||
| 8037 | (string-to-number ostr 8))) | ||
| 8038 | |||
| 8039 | (defun tramp-shell-case-fold (string) | 8068 | (defun tramp-shell-case-fold (string) |
| 8040 | "Converts STRING to shell glob pattern which ignores case." | 8069 | "Converts STRING to shell glob pattern which ignores case." |
| 8041 | (mapconcat | 8070 | (mapconcat |
| @@ -8046,145 +8075,6 @@ Not actually used. Use `(format \"%o\" i)' instead?" | |||
| 8046 | string | 8075 | string |
| 8047 | "")) | 8076 | "")) |
| 8048 | 8077 | ||
| 8049 | |||
| 8050 | ;; ------------------------------------------------------------ | ||
| 8051 | ;; -- Tramp file names -- | ||
| 8052 | ;; ------------------------------------------------------------ | ||
| 8053 | ;; Conversion functions between external representation and | ||
| 8054 | ;; internal data structure. Convenience functions for internal | ||
| 8055 | ;; data structure. | ||
| 8056 | |||
| 8057 | (defun tramp-file-name-p (vec) | ||
| 8058 | "Check, whether VEC is a Tramp object." | ||
| 8059 | (and (vectorp vec) (= 4 (length vec)))) | ||
| 8060 | |||
| 8061 | (defun tramp-file-name-method (vec) | ||
| 8062 | "Return method component of VEC." | ||
| 8063 | (and (tramp-file-name-p vec) (aref vec 0))) | ||
| 8064 | |||
| 8065 | (defun tramp-file-name-user (vec) | ||
| 8066 | "Return user component of VEC." | ||
| 8067 | (and (tramp-file-name-p vec) (aref vec 1))) | ||
| 8068 | |||
| 8069 | (defun tramp-file-name-host (vec) | ||
| 8070 | "Return host component of VEC." | ||
| 8071 | (and (tramp-file-name-p vec) (aref vec 2))) | ||
| 8072 | |||
| 8073 | (defun tramp-file-name-localname (vec) | ||
| 8074 | "Return localname component of VEC." | ||
| 8075 | (and (tramp-file-name-p vec) (aref vec 3))) | ||
| 8076 | |||
| 8077 | ;; The user part of a Tramp file name vector can be of kind | ||
| 8078 | ;; "user%domain". Sometimes, we must extract these parts. | ||
| 8079 | (defun tramp-file-name-real-user (vec) | ||
| 8080 | "Return the user name of VEC without domain." | ||
| 8081 | (save-match-data | ||
| 8082 | (let ((user (tramp-file-name-user vec))) | ||
| 8083 | (if (and (stringp user) | ||
| 8084 | (string-match tramp-user-with-domain-regexp user)) | ||
| 8085 | (match-string 1 user) | ||
| 8086 | user)))) | ||
| 8087 | |||
| 8088 | (defun tramp-file-name-domain (vec) | ||
| 8089 | "Return the domain name of VEC." | ||
| 8090 | (save-match-data | ||
| 8091 | (let ((user (tramp-file-name-user vec))) | ||
| 8092 | (and (stringp user) | ||
| 8093 | (string-match tramp-user-with-domain-regexp user) | ||
| 8094 | (match-string 2 user))))) | ||
| 8095 | |||
| 8096 | ;; The host part of a Tramp file name vector can be of kind | ||
| 8097 | ;; "host#port". Sometimes, we must extract these parts. | ||
| 8098 | (defun tramp-file-name-real-host (vec) | ||
| 8099 | "Return the host name of VEC without port." | ||
| 8100 | (save-match-data | ||
| 8101 | (let ((host (tramp-file-name-host vec))) | ||
| 8102 | (if (and (stringp host) | ||
| 8103 | (string-match tramp-host-with-port-regexp host)) | ||
| 8104 | (match-string 1 host) | ||
| 8105 | host)))) | ||
| 8106 | |||
| 8107 | (defun tramp-file-name-port (vec) | ||
| 8108 | "Return the port number of VEC." | ||
| 8109 | (save-match-data | ||
| 8110 | (let ((host (tramp-file-name-host vec))) | ||
| 8111 | (and (stringp host) | ||
| 8112 | (string-match tramp-host-with-port-regexp host) | ||
| 8113 | (string-to-number (match-string 2 host)))))) | ||
| 8114 | |||
| 8115 | (defun tramp-tramp-file-p (name) | ||
| 8116 | "Return t if NAME is a string with Tramp file name syntax." | ||
| 8117 | (save-match-data | ||
| 8118 | (and (stringp name) (string-match tramp-file-name-regexp name)))) | ||
| 8119 | |||
| 8120 | (defun tramp-find-method (method user host) | ||
| 8121 | "Return the right method string to use. | ||
| 8122 | This is METHOD, if non-nil. Otherwise, do a lookup in | ||
| 8123 | `tramp-default-method-alist'." | ||
| 8124 | (or method | ||
| 8125 | (let ((choices tramp-default-method-alist) | ||
| 8126 | lmethod item) | ||
| 8127 | (while choices | ||
| 8128 | (setq item (pop choices)) | ||
| 8129 | (when (and (string-match (or (nth 0 item) "") (or host "")) | ||
| 8130 | (string-match (or (nth 1 item) "") (or user ""))) | ||
| 8131 | (setq lmethod (nth 2 item)) | ||
| 8132 | (setq choices nil))) | ||
| 8133 | lmethod) | ||
| 8134 | tramp-default-method)) | ||
| 8135 | |||
| 8136 | (defun tramp-find-user (method user host) | ||
| 8137 | "Return the right user string to use. | ||
| 8138 | This is USER, if non-nil. Otherwise, do a lookup in | ||
| 8139 | `tramp-default-user-alist'." | ||
| 8140 | (or user | ||
| 8141 | (let ((choices tramp-default-user-alist) | ||
| 8142 | luser item) | ||
| 8143 | (while choices | ||
| 8144 | (setq item (pop choices)) | ||
| 8145 | (when (and (string-match (or (nth 0 item) "") (or method "")) | ||
| 8146 | (string-match (or (nth 1 item) "") (or host ""))) | ||
| 8147 | (setq luser (nth 2 item)) | ||
| 8148 | (setq choices nil))) | ||
| 8149 | luser) | ||
| 8150 | tramp-default-user)) | ||
| 8151 | |||
| 8152 | (defun tramp-find-host (method user host) | ||
| 8153 | "Return the right host string to use. | ||
| 8154 | This is HOST, if non-nil. Otherwise, it is `tramp-default-host'." | ||
| 8155 | (or (and (> (length host) 0) host) | ||
| 8156 | tramp-default-host)) | ||
| 8157 | |||
| 8158 | (defun tramp-dissect-file-name (name &optional nodefault) | ||
| 8159 | "Return a `tramp-file-name' structure. | ||
| 8160 | The structure consists of remote method, remote user, remote host | ||
| 8161 | and localname (file name on remote host). If NODEFAULT is | ||
| 8162 | non-nil, the file name parts are not expanded to their default | ||
| 8163 | values." | ||
| 8164 | (save-match-data | ||
| 8165 | (let ((match (string-match (nth 0 tramp-file-name-structure) name))) | ||
| 8166 | (unless match (error "Not a Tramp file name: %s" name)) | ||
| 8167 | (let ((method (match-string (nth 1 tramp-file-name-structure) name)) | ||
| 8168 | (user (match-string (nth 2 tramp-file-name-structure) name)) | ||
| 8169 | (host (match-string (nth 3 tramp-file-name-structure) name)) | ||
| 8170 | (localname (match-string (nth 4 tramp-file-name-structure) name))) | ||
| 8171 | (when (member method '("multi" "multiu")) | ||
| 8172 | (error | ||
| 8173 | "`%s' method is no longer supported, see (info \"(tramp)Multi-hops\")" | ||
| 8174 | method)) | ||
| 8175 | (when host | ||
| 8176 | (when (string-match tramp-prefix-ipv6-regexp host) | ||
| 8177 | (setq host (replace-match "" nil t host))) | ||
| 8178 | (when (string-match tramp-postfix-ipv6-regexp host) | ||
| 8179 | (setq host (replace-match "" nil t host)))) | ||
| 8180 | (if nodefault | ||
| 8181 | (vector method user host localname) | ||
| 8182 | (vector | ||
| 8183 | (tramp-find-method method user host) | ||
| 8184 | (tramp-find-user method user host) | ||
| 8185 | (tramp-find-host method user host) | ||
| 8186 | localname)))))) | ||
| 8187 | |||
| 8188 | (defun tramp-equal-remote (file1 file2) | 8078 | (defun tramp-equal-remote (file1 file2) |
| 8189 | "Check, whether the remote parts of FILE1 and FILE2 are identical. | 8079 | "Check, whether the remote parts of FILE1 and FILE2 are identical. |
| 8190 | The check depends on method, user and host name of the files. If | 8080 | The check depends on method, user and host name of the files. If |
| @@ -8203,37 +8093,6 @@ would yield `t'. On the other hand, the following check results in nil: | |||
| 8203 | (stringp (file-remote-p file2)) | 8093 | (stringp (file-remote-p file2)) |
| 8204 | (string-equal (file-remote-p file1) (file-remote-p file2)))) | 8094 | (string-equal (file-remote-p file1) (file-remote-p file2)))) |
| 8205 | 8095 | ||
| 8206 | (defun tramp-make-tramp-file-name (method user host localname) | ||
| 8207 | "Constructs a Tramp file name from METHOD, USER, HOST and LOCALNAME." | ||
| 8208 | (concat tramp-prefix-format | ||
| 8209 | (when (not (zerop (length method))) | ||
| 8210 | (concat method tramp-postfix-method-format)) | ||
| 8211 | (when (not (zerop (length user))) | ||
| 8212 | (concat user tramp-postfix-user-format)) | ||
| 8213 | (when host | ||
| 8214 | (if (string-match tramp-ipv6-regexp host) | ||
| 8215 | (concat tramp-prefix-ipv6-format host tramp-postfix-ipv6-format) | ||
| 8216 | host)) | ||
| 8217 | tramp-postfix-host-format | ||
| 8218 | (when localname localname))) | ||
| 8219 | |||
| 8220 | (defun tramp-completion-make-tramp-file-name (method user host localname) | ||
| 8221 | "Constructs a Tramp file name from METHOD, USER, HOST and LOCALNAME. | ||
| 8222 | It must not be a complete Tramp file name, but as long as there are | ||
| 8223 | necessary only. This function will be used in file name completion." | ||
| 8224 | (concat tramp-prefix-format | ||
| 8225 | (when (not (zerop (length method))) | ||
| 8226 | (concat method tramp-postfix-method-format)) | ||
| 8227 | (when (not (zerop (length user))) | ||
| 8228 | (concat user tramp-postfix-user-format)) | ||
| 8229 | (when (not (zerop (length host))) | ||
| 8230 | (concat | ||
| 8231 | (if (string-match tramp-ipv6-regexp host) | ||
| 8232 | (concat tramp-prefix-ipv6-format host tramp-postfix-ipv6-format) | ||
| 8233 | host) | ||
| 8234 | tramp-postfix-host-format)) | ||
| 8235 | (when localname localname))) | ||
| 8236 | |||
| 8237 | (defun tramp-make-copy-program-file-name (vec) | 8096 | (defun tramp-make-copy-program-file-name (vec) |
| 8238 | "Create a file name suitable to be passed to `rcp' and workalikes." | 8097 | "Create a file name suitable to be passed to `rcp' and workalikes." |
| 8239 | (let ((user (tramp-file-name-user vec)) | 8098 | (let ((user (tramp-file-name-user vec)) |
| @@ -8281,6 +8140,7 @@ necessary only. This function will be used in file name completion." | |||
| 8281 | 8140 | ||
| 8282 | ;; Variables local to connection. | 8141 | ;; Variables local to connection. |
| 8283 | 8142 | ||
| 8143 | ;;;###tramp-autoload | ||
| 8284 | (defun tramp-get-remote-path (vec) | 8144 | (defun tramp-get-remote-path (vec) |
| 8285 | (with-connection-property | 8145 | (with-connection-property |
| 8286 | ;; When `tramp-own-remote-path' is in `tramp-remote-path', we | 8146 | ;; When `tramp-own-remote-path' is in `tramp-remote-path', we |
| @@ -8354,6 +8214,7 @@ necessary only. This function will be used in file name completion." | |||
| 8354 | x)) | 8214 | x)) |
| 8355 | remote-path))))) | 8215 | remote-path))))) |
| 8356 | 8216 | ||
| 8217 | ;;;###tramp-autoload | ||
| 8357 | (defun tramp-get-remote-tmpdir (vec) | 8218 | (defun tramp-get-remote-tmpdir (vec) |
| 8358 | (with-connection-property vec "tmp-directory" | 8219 | (with-connection-property vec "tmp-directory" |
| 8359 | (let ((dir (tramp-shell-quote-argument "/tmp"))) | 8220 | (let ((dir (tramp-shell-quote-argument "/tmp"))) |
| @@ -8435,6 +8296,7 @@ necessary only. This function will be used in file name completion." | |||
| 8435 | (tramp-message vec 5 "Finding command to check if file exists") | 8296 | (tramp-message vec 5 "Finding command to check if file exists") |
| 8436 | (tramp-find-file-exists-command vec))) | 8297 | (tramp-find-file-exists-command vec))) |
| 8437 | 8298 | ||
| 8299 | ;;;###tramp-autoload | ||
| 8438 | (defun tramp-get-remote-ln (vec) | 8300 | (defun tramp-get-remote-ln (vec) |
| 8439 | (with-connection-property vec "ln" | 8301 | (with-connection-property vec "ln" |
| 8440 | (tramp-message vec 5 "Finding a suitable `ln' command") | 8302 | (tramp-message vec 5 "Finding a suitable `ln' command") |
| @@ -8682,8 +8544,9 @@ If the `tramp-methods' entry does not exist, return nil." | |||
| 8682 | ;; Permissions should be set always, because there might be an old | 8544 | ;; Permissions should be set always, because there might be an old |
| 8683 | ;; auto-saved file belonging to another original file. This could | 8545 | ;; auto-saved file belonging to another original file. This could |
| 8684 | ;; be a security threat. | 8546 | ;; be a security threat. |
| 8685 | (set-file-modes buffer-auto-save-file-name | 8547 | (set-file-modes |
| 8686 | (or (file-modes bfn) (tramp-octal-to-decimal "0600")))))) | 8548 | buffer-auto-save-file-name |
| 8549 | (or (file-modes bfn) (tramp-compat-octal-to-decimal "0600")))))) | ||
| 8687 | 8550 | ||
| 8688 | (unless (and (featurep 'xemacs) | 8551 | (unless (and (featurep 'xemacs) |
| 8689 | (= emacs-major-version 21) | 8552 | (= emacs-major-version 21) |
| @@ -8787,7 +8650,6 @@ Return the difference in the format of a time value." | |||
| 8787 | (defun tramp-time-diff (t1 t2) | 8650 | (defun tramp-time-diff (t1 t2) |
| 8788 | "Return the difference between the two times, in seconds. | 8651 | "Return the difference between the two times, in seconds. |
| 8789 | T1 and T2 are time values (as returned by `current-time' for example)." | 8652 | T1 and T2 are time values (as returned by `current-time' for example)." |
| 8790 | ;; Pacify byte-compiler with `symbol-function'. | ||
| 8791 | (cond ((and (fboundp 'subtract-time) | 8653 | (cond ((and (fboundp 'subtract-time) |
| 8792 | (fboundp 'float-time)) | 8654 | (fboundp 'float-time)) |
| 8793 | (tramp-compat-funcall | 8655 | (tramp-compat-funcall |
| @@ -8863,6 +8725,7 @@ exiting if process is running." | |||
| 8863 | ;; CCC: This function should be rewritten so that | 8725 | ;; CCC: This function should be rewritten so that |
| 8864 | ;; `shell-quote-argument' is not used. This way, we are safe from | 8726 | ;; `shell-quote-argument' is not used. This way, we are safe from |
| 8865 | ;; changes in `shell-quote-argument'. | 8727 | ;; changes in `shell-quote-argument'. |
| 8728 | ;;;###tramp-autoload | ||
| 8866 | (defun tramp-shell-quote-argument (s) | 8729 | (defun tramp-shell-quote-argument (s) |
| 8867 | "Similar to `shell-quote-argument', but groks newlines. | 8730 | "Similar to `shell-quote-argument', but groks newlines. |
| 8868 | Only works for Bourne-like shells." | 8731 | Only works for Bourne-like shells." |
| @@ -8888,11 +8751,9 @@ Only works for Bourne-like shells." | |||
| 8888 | (defun tramp-unload-tramp () | 8751 | (defun tramp-unload-tramp () |
| 8889 | "Discard Tramp from loading remote files." | 8752 | "Discard Tramp from loading remote files." |
| 8890 | (interactive) | 8753 | (interactive) |
| 8891 | ;; When Tramp is not loaded yet, its autoloads are still active. | ||
| 8892 | (tramp-unload-file-name-handlers) | ||
| 8893 | ;; ange-ftp settings must be enabled. | 8754 | ;; ange-ftp settings must be enabled. |
| 8894 | (tramp-compat-funcall 'tramp-ftp-enable-ange-ftp) | 8755 | (tramp-compat-funcall 'tramp-ftp-enable-ange-ftp) |
| 8895 | ;; Maybe its not loaded yet. | 8756 | ;; Maybe it's not loaded yet. |
| 8896 | (condition-case nil | 8757 | (condition-case nil |
| 8897 | (unload-feature 'tramp 'force) | 8758 | (unload-feature 'tramp 'force) |
| 8898 | (error nil))) | 8759 | (error nil))) |
| @@ -8991,7 +8852,6 @@ Only works for Bourne-like shells." | |||
| 8991 | ;; expects English? Or just to set LC_MESSAGES to "C" if Tramp | 8852 | ;; expects English? Or just to set LC_MESSAGES to "C" if Tramp |
| 8992 | ;; expects only English messages? (Juri Linkov) | 8853 | ;; expects only English messages? (Juri Linkov) |
| 8993 | ;; * Make shadowfile.el grok Tramp filenames. (Bug#4526, Bug#4846) | 8854 | ;; * Make shadowfile.el grok Tramp filenames. (Bug#4526, Bug#4846) |
| 8994 | ;; * Load Tramp subpackages only when needed. (Bug#1529, Bug#5448, Bug#5705) | ||
| 8995 | ;; * Try telnet+curl as new method. It might be useful for busybox, | 8855 | ;; * Try telnet+curl as new method. It might be useful for busybox, |
| 8996 | ;; without built-in uuencode/uudecode. | 8856 | ;; without built-in uuencode/uudecode. |
| 8997 | ;; * Load ~/.emacs_SHELLNAME on the remote host for `shell'. | 8857 | ;; * Load ~/.emacs_SHELLNAME on the remote host for `shell'. |
diff --git a/lisp/net/trampver.el b/lisp/net/trampver.el index 8725721869d..7690e859310 100644 --- a/lisp/net/trampver.el +++ b/lisp/net/trampver.el | |||
| @@ -31,16 +31,29 @@ | |||
| 31 | ;; version check is defined in macro AC_EMACS_INFO of aclocal.m4; | 31 | ;; version check is defined in macro AC_EMACS_INFO of aclocal.m4; |
| 32 | ;; should be changed only there. | 32 | ;; should be changed only there. |
| 33 | 33 | ||
| 34 | (defconst tramp-version "2.1.19" | 34 | ;;;###tramp-autoload |
| 35 | (defconst tramp-version "2.2.0-pre" | ||
| 35 | "This version of Tramp.") | 36 | "This version of Tramp.") |
| 36 | 37 | ||
| 38 | ;;;###tramp-autoload | ||
| 37 | (defconst tramp-bug-report-address "tramp-devel@gnu.org" | 39 | (defconst tramp-bug-report-address "tramp-devel@gnu.org" |
| 38 | "Email address to send bug reports to.") | 40 | "Email address to send bug reports to.") |
| 39 | 41 | ||
| 40 | ;; Check for (X)Emacs version. | 42 | ;; Check for (X)Emacs version. |
| 41 | (let ((x (if (or (>= emacs-major-version 22) (and (featurep 'xemacs) (= emacs-major-version 21) (>= emacs-minor-version 4))) "ok" (format "Tramp 2.1.19 is not fit for %s" (when (string-match "^.*$" (emacs-version)) (match-string 0 (emacs-version))))))) | 43 | (let ((x (if (or (>= emacs-major-version 22) |
| 44 | (and (featurep 'xemacs) | ||
| 45 | (= emacs-major-version 21) | ||
| 46 | (>= emacs-minor-version 4))) | ||
| 47 | "ok" | ||
| 48 | (format "Tramp 2.2.0-pre is not fit for %s" | ||
| 49 | (when (string-match "^.*$" (emacs-version)) | ||
| 50 | (match-string 0 (emacs-version))))))) | ||
| 42 | (unless (string-match "\\`ok\\'" x) (error "%s" x))) | 51 | (unless (string-match "\\`ok\\'" x) (error "%s" x))) |
| 43 | 52 | ||
| 53 | (add-hook 'tramp-unload-hook | ||
| 54 | (lambda () | ||
| 55 | (unload-feature 'trampver 'force))) | ||
| 56 | |||
| 44 | (provide 'trampver) | 57 | (provide 'trampver) |
| 45 | 58 | ||
| 46 | ;; arch-tag: 443576ca-f8f1-4bb1-addc-5c70861e93b1 | 59 | ;; arch-tag: 443576ca-f8f1-4bb1-addc-5c70861e93b1 |