Commit 0f34aa77 authored by Michael Albinus's avatar Michael Albinus

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.
parent 308e764f
2010-09-08 Michael Albinus <michael.albinus@gmx.de>
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.
2010-09-07 Agustín Martín <agustin.martin@hispalinux.es>
* textmodes/ispell.el (ispell-start-process): Make sure original
......
......@@ -56,7 +56,8 @@ ETAGS = ../lib-src/etags
LOADDEFS = $(lisp)/calendar/cal-loaddefs.el \
$(lisp)/calendar/diary-loaddefs.el \
$(lisp)/calendar/hol-loaddefs.el \
$(lisp)/mh-e/mh-loaddefs.el
$(lisp)/mh-e/mh-loaddefs.el \
$(lisp)/net/tramp-loaddefs.el
# Elisp files auto-generated.
AUTOGENEL = loaddefs.el \
......@@ -329,6 +330,24 @@ $(MH_E_DIR)/mh-loaddefs.el: $(MH_E_SRC)
--eval "(setq make-backup-files nil)" \
-f batch-update-autoloads $(MH_E_DIR)
# Update TRAMP internal autoloads. Maybe we could move trmp*.el into
# an own subdirectory. OTOH, it does not hurt to keep them in
# lisp/net.
TRAMP_DIR = $(lisp)/net
TRAMP_SRC = $(TRAMP_DIR)/tramp.el $(TRAMP_DIR)/tramp-cache.el \
$(TRAMP_DIR)/tramp-cmds.el $(TRAMP_DIR)/tramp-compat.el \
$(TRAMP_DIR)/tramp-fish.el $(TRAMP_DIR)/tramp-ftp.el \
$(TRAMP_DIR)/tramp-gvfs.el $(TRAMP_DIR)/tramp-gw.el \
$(TRAMP_DIR)/tramp-imap.el $(TRAMP_DIR)/tramp-smb.el \
$(TRAMP_DIR)/tramp-uu.el $(TRAMP_DIR)/trampver.el
$(TRAMP_DIR)/tramp-loaddefs.el: $(TRAMP_SRC)
$(emacs) -l autoload \
--eval "(setq generate-autoload-cookie \";;;###tramp-autoload\")" \
--eval "(setq generated-autoload-file \"$@\")" \
--eval "(setq make-backup-files nil)" \
-f batch-update-autoloads $(TRAMP_DIR)
CAL_DIR = $(lisp)/calendar
## Those files that may contain internal calendar autoload cookies.
## Avoids circular dependency warning for *-loaddefs.el.
......
......@@ -50,24 +50,12 @@
;;; Code:
;; Pacify byte-compiler.
(eval-when-compile
(require 'cl)
(autoload 'tramp-message "tramp")
(autoload 'tramp-tramp-file-p "tramp")
;; We cannot autoload macro `with-parsed-tramp-file-name', it
;; results in problems of byte-compiled code.
(autoload 'tramp-dissect-file-name "tramp")
(autoload 'tramp-file-name-method "tramp")
(autoload 'tramp-file-name-user "tramp")
(autoload 'tramp-file-name-host "tramp")
(autoload 'tramp-file-name-localname "tramp")
(autoload 'tramp-run-real-handler "tramp")
(autoload 'tramp-time-less-p "tramp")
(autoload 'time-stamp-string "time-stamp"))
(require 'tramp)
(autoload 'time-stamp-string "time-stamp")
;;; -- Cache --
;;;###tramp-autoload
(defvar tramp-cache-data (make-hash-table :test 'equal)
"Hash table for remote files properties.")
......@@ -103,6 +91,7 @@ time.")
(defvar tramp-cache-data-changed nil
"Whether persistent cache data have been changed.")
;;;###tramp-autoload
(defun tramp-get-file-property (vec file property default)
"Get the PROPERTY of FILE from the cache context of VEC.
Returns DEFAULT if not set."
......@@ -130,6 +119,7 @@ Returns DEFAULT if not set."
(tramp-message vec 8 "%s %s %s" file property value)
value))
;;;###tramp-autoload
(defun tramp-set-file-property (vec file property value)
"Set the PROPERTY of FILE to VALUE, in the cache context of VEC.
Returns VALUE."
......@@ -144,6 +134,26 @@ Returns VALUE."
(tramp-message vec 8 "%s %s %s" file property value)
value))
;;;###tramp-autoload
(defmacro with-file-property (vec file property &rest body)
"Check in Tramp cache for PROPERTY, otherwise execute BODY and set cache.
FILE must be a local file name on a connection identified via VEC."
`(if (file-name-absolute-p ,file)
(let ((value (tramp-get-file-property ,vec ,file ,property 'undef)))
(when (eq value 'undef)
;; We cannot pass @body as parameter to
;; `tramp-set-file-property' because it mangles our
;; debug messages.
(setq value (progn ,@body))
(tramp-set-file-property ,vec ,file ,property value))
value)
,@body))
(put 'with-file-property 'lisp-indent-function 3)
(put 'with-file-property 'edebug-form-spec t)
(font-lock-add-keywords 'emacs-lisp-mode '("\\<with-file-property\\>"))
;;;###tramp-autoload
(defun tramp-flush-file-property (vec file)
"Remove all properties of FILE in the cache context of VEC."
;; Unify localname.
......@@ -152,6 +162,7 @@ Returns VALUE."
(tramp-message vec 8 "%s" file)
(remhash vec tramp-cache-data))
;;;###tramp-autoload
(defun tramp-flush-directory-property (vec directory)
"Remove all properties of DIRECTORY in the cache context of VEC.
Remove also properties of all files in subdirectories."
......@@ -175,8 +186,7 @@ Remove also properties of all files in subdirectories."
(buffer-file-name)
default-directory)))
(when (tramp-tramp-file-p bfn)
(let* ((v (tramp-dissect-file-name bfn))
(localname (tramp-file-name-localname v)))
(with-parsed-tramp-file-name bfn nil
(tramp-flush-file-property v localname)))))
(add-hook 'before-revert-hook 'tramp-flush-file-function)
......@@ -193,6 +203,7 @@ Remove also properties of all files in subdirectories."
;;; -- Properties --
;;;###tramp-autoload
(defun tramp-get-connection-property (key property default)
"Get the named PROPERTY for the connection.
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."
(tramp-message key 7 "%s %s" property value)
value))
;;;###tramp-autoload
(defun tramp-set-connection-property (key property value)
"Set the named PROPERTY of a connection to VALUE.
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."
(error nil))
value))
;;;###tramp-autoload
(defmacro with-connection-property (key property &rest body)
"Check in Tramp for property PROPERTY, otherwise executes BODY and set."
`(let ((value (tramp-get-connection-property ,key ,property 'undef)))
(when (eq value 'undef)
;; We cannot pass ,@body as parameter to
;; `tramp-set-connection-property' because it mangles our debug
;; messages.
(setq value (progn ,@body))
(tramp-set-connection-property ,key ,property value))
value))
(put 'with-connection-property 'lisp-indent-function 2)
(put 'with-connection-property 'edebug-form-spec t)
(font-lock-add-keywords 'emacs-lisp-mode '("\\<with-connection-property\\>"))
;;;###tramp-autoload
(defun tramp-flush-connection-property (key)
"Remove all properties identified by KEY.
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."
(setq tramp-cache-data-changed t)
(remhash key tramp-cache-data))
;;;###tramp-autoload
(defun tramp-cache-print (table)
"Print hash table TABLE."
(when (hash-table-p table)
......@@ -271,6 +301,7 @@ KEY identifies the connection, it is either a process or a vector."
table)
result)))
;;;###tramp-autoload
(defun tramp-list-connections ()
"Return a list of all known connection vectors according to `tramp-cache'."
(let (result)
......@@ -364,6 +395,10 @@ for all methods. Resulting data are derived from connection history."
tramp-persistency-file-name (error-message-string err))
(clrhash tramp-cache-data))))
(add-hook 'tramp-unload-hook
(lambda ()
(unload-feature 'tramp-cache 'force)))
(provide 'tramp-cache)
;; arch-tag: ee1739b7-7628-408c-9b96-d11a74b05d26
......
......@@ -129,6 +129,7 @@ This includes password cache, file cache, connection cache, buffers."
;; Tramp version is useful in a number of situations.
;;;###tramp-autoload
(defun tramp-version (arg)
"Print version number of tramp.el in minibuffer or current buffer."
(interactive "P")
......@@ -387,6 +388,9 @@ please ensure that the buffers are attached to your email.\n\n")
(defalias 'tramp-submit-bug 'tramp-bug)
(add-hook 'tramp-unload-hook
(lambda () (unload-feature 'tramp-cmds 'force)))
(provide 'tramp-cmds)
;;; TODO:
......@@ -395,7 +399,7 @@ please ensure that the buffers are attached to your email.\n\n")
;; * WIBNI there was an interactive command prompting for Tramp
;; method, hostname, username and filename and translates the user
;; input into the correct filename syntax (depending on the Emacs
;; flavor) (Reiner Steib)
;; flavor) (Reiner Steib)
;; * Let the user edit the connection properties interactively.
;; Something like `gnus-server-edit-server' in Gnus' *Server* buffer.
;; * 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")
;; Option and should not be modified by the code. add-to-list is
;; called in several places. One way to handle that is to have a new
;; ordinary variable that gets its initial value from
;; tramp-default-user-alist and then is added to. (Pete Forman)
;; tramp-default-user-alist and then is added to. (Pete Forman)
;; arch-tag: 190d4c33-76bb-4e99-8b6f-71741f23d98c
;;; tramp-cmds.el ends here
......@@ -29,6 +29,8 @@
;;; Code:
(require 'tramp-loaddefs)
(eval-when-compile
;; Pacify byte-compiler.
......@@ -43,33 +45,20 @@
(require 'timer-funcs)
(require 'timer))
(autoload 'tramp-tramp-file-p "tramp")
(autoload 'tramp-file-name-handler "tramp")
;; We check whether `start-file-process' is bound.
(unless (fboundp 'start-file-process)
;; tramp-util offers integration into other (X)Emacs packages like
;; compile.el, gud.el etc. Not necessary in Emacs 23.
(eval-after-load "tramp"
'(progn
(require 'tramp-util)
(add-hook 'tramp-unload-hook
'(lambda ()
(when (featurep 'tramp-util)
(unload-feature 'tramp-util 'force))))))
'(require 'tramp-util))
;; Make sure that we get integration with the VC package. When it
;; is loaded, we need to pull in the integration module. Not
;; necessary in Emacs 23.
(eval-after-load "vc"
(eval-after-load "tramp"
'(progn
(require 'tramp-vc)
(add-hook 'tramp-unload-hook
'(lambda ()
(when (featurep 'tramp-vc)
(unload-feature 'tramp-vc 'force))))))))
'(require 'tramp-vc))))
;; Avoid byte-compiler warnings if the byte-compiler supports this.
;; Currently, XEmacs supports this.
......@@ -263,6 +252,24 @@ Add the extension of FILENAME, if existing."
;; Default value in XEmacs.
(t 134217727)))
(defun tramp-compat-decimal-to-octal (i)
"Return a string consisting of the octal digits of I.
Not actually used. Use `(format \"%o\" i)' instead?"
(cond ((< i 0) (error "Cannot convert negative number to octal"))
((not (integerp i)) (error "Cannot convert non-integer to octal"))
((zerop i) "0")
(t (concat (tramp-compat-decimal-to-octal (/ i 8))
(number-to-string (% i 8))))))
;; Kudos to Gerd Moellmann for this suggestion.
(defun tramp-compat-octal-to-decimal (ostr)
"Given a string of octal digits, return a decimal number."
(let ((x (or ostr "")))
;; `save-match' is in `tramp-mode-string-to-int' which calls this.
(unless (string-match "\\`[0-7]*\\'" x)
(error "Non-octal junk in string `%s'" x))
(string-to-number ostr 8)))
;; ID-FORMAT does not exists in XEmacs.
(defun tramp-compat-file-attributes (filename &optional id-format)
"Like `file-attributes' for Tramp files (compat function)."
......@@ -397,6 +404,20 @@ This is, the first, empty, element is omitted. In XEmacs, the first
element is not omitted."
(delete "" (split-string string pattern)))
(defun tramp-compat-call-process
(program &optional infile destination display &rest args)
"Calls `call-process' on the local host.
This is needed because for some Emacs flavors Tramp has
defadviced `call-process' to behave like `process-file'. The
Lisp error raised when PROGRAM is nil is trapped also, returning 1."
(let ((default-directory
(if (file-remote-p default-directory)
(tramp-compat-temporary-file-directory)
default-directory)))
(if (executable-find program)
(apply 'call-process program infile destination display args)
1)))
(defun tramp-compat-process-running-p (process-name)
"Returns `t' if system process PROCESS-NAME is running for `user-login-name'."
(when (stringp process-name)
......@@ -439,6 +460,10 @@ element is not omitted."
(setenv "UNIX95" unix95)
result)))))
(add-hook 'tramp-unload-hook
(lambda ()
(unload-feature 'tramp-compat 'force)))
(provide 'tramp-compat)
;;; TODO:
......
......@@ -157,16 +157,14 @@
(require 'cl))
(require 'tramp)
(require 'tramp-cache)
(require 'tramp-compat)
;; Define FISH method ...
(defcustom tramp-fish-method "fish"
"*Method to connect via FISH protocol."
:group 'tramp
:type 'string)
;;;###tramp-autoload
(defconst tramp-fish-method "fish"
"*Method to connect via FISH protocol.")
;; ... and add it to the method list.
;;;###tramp-autoload
(add-to-list 'tramp-methods (cons tramp-fish-method nil))
;; 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.")
"Alist of handler functions for Tramp FISH method.
Operations not mentioned here will be handled by the default Emacs primitives.")
(defun tramp-fish-file-name-p (filename)
;;;###tramp-autoload
(defsubst tramp-fish-file-name-p (filename)
"Check if it's a filename for FISH protocol."
(let ((v (tramp-dissect-file-name filename)))
(string= (tramp-file-name-method v) tramp-fish-method)))
;;;###tramp-autoload
(defun tramp-fish-file-name-handler (operation &rest args)
"Invoke the FISH related OPERATION.
First arg specifies the OPERATION, second arg is a list of arguments to
......@@ -278,6 +278,7 @@ pass to the OPERATION."
(save-match-data (apply (cdr fn) args))
(tramp-run-real-handler operation args))))
;;;###tramp-autoload
(add-to-list 'tramp-foreign-file-name-handler-alist
(cons 'tramp-fish-file-name-p 'tramp-fish-file-name-handler))
......@@ -688,7 +689,7 @@ target of the symlink differ."
(tramp-flush-file-property v localname)
(unless (tramp-fish-send-command-and-check
v (format "#CHMOD %s %s"
(tramp-decimal-to-octal mode)
(tramp-compat-decimal-to-octal mode)
(tramp-shell-quote-argument localname)))
(tramp-error
v 'file-error "Error while changing file's mode %s" filename))))
......@@ -1170,6 +1171,10 @@ Returns nil if there has been an error message."
(goto-char (point-min))
(looking-at tramp-fish-ok-prompt-regexp)))
(add-hook 'tramp-unload-hook
(lambda ()
(unload-feature 'tramp-fish 'force)))
(provide 'tramp-fish)
;
;;;; TODO:
......
......@@ -30,7 +30,6 @@
;;; Code:
(require 'tramp)
(autoload 'tramp-set-connection-property "tramp-cache")
(eval-when-compile
......@@ -99,13 +98,14 @@ present for backward compatibility."
(add-hook 'tramp-ftp-unload-hook 'tramp-ftp-enable-ange-ftp)
;; Define FTP method ...
(defcustom tramp-ftp-method "ftp"
"*When this method name is used, forward all calls to Ange-FTP."
:group 'tramp
:type 'string)
;;;###tramp-autoload
(defconst tramp-ftp-method "ftp"
"*When this method name is used, forward all calls to Ange-FTP.")
;; ... and add it to the method list.
(add-to-list 'tramp-methods (cons tramp-ftp-method nil))
;;;###tramp-autoload
(unless (featurep 'xemacs)
(add-to-list 'tramp-methods (cons tramp-ftp-method nil)))
;; Add some defaults for `tramp-default-method-alist'
(add-to-list 'tramp-default-method-alist
......@@ -129,6 +129,7 @@ present for backward compatibility."
(symbol-plist
'substitute-in-file-name))))))
;;;###tramp-autoload
(defun tramp-ftp-file-name-handler (operation &rest args)
"Invoke the Ange-FTP handler for OPERATION.
First arg specifies the OPERATION, second arg is a list of arguments to
......@@ -199,13 +200,20 @@ pass to the OPERATION."
(inhibit-file-name-operation operation))
(apply 'ange-ftp-hook-function operation args)))))))
(defun tramp-ftp-file-name-p (filename)
;;;###tramp-autoload
(defsubst tramp-ftp-file-name-p (filename)
"Check if it's a filename that should be forwarded to Ange-FTP."
(let ((v (tramp-dissect-file-name filename)))
(string= (tramp-file-name-method v) tramp-ftp-method)))
(add-to-list 'tramp-foreign-file-name-handler-alist
(cons 'tramp-ftp-file-name-p 'tramp-ftp-file-name-handler))
;;;###tramp-autoload
(unless (featurep 'xemacs)
(add-to-list 'tramp-foreign-file-name-handler-alist
(cons 'tramp-ftp-file-name-p 'tramp-ftp-file-name-handler)))
(add-hook 'tramp-unload-hook
(lambda ()
(unload-feature 'tramp-ftp 'force)))
(provide 'tramp-ftp)
......
......@@ -108,6 +108,7 @@
(require 'url-util)
(require 'zeroconf)
;;;###tramp-autoload
(defcustom tramp-gvfs-methods '("dav" "davs" "obex" "synce")
"*List of methods for remote files, accessed with GVFS."
:group 'tramp
......@@ -133,11 +134,11 @@
;; Add the methods to `tramp-methods', in order to allow minibuffer
;; completion.
(eval-after-load "tramp-gvfs"
'(when (featurep 'tramp-gvfs)
(dolist (elt tramp-gvfs-methods)
(unless (assoc elt tramp-methods)
(add-to-list 'tramp-methods (cons elt nil))))))
;;;###tramp-autoload
(when (featurep 'dbusbind)
(dolist (elt tramp-gvfs-methods)
(unless (assoc elt tramp-methods)
(add-to-list 'tramp-methods (cons elt nil)))))
(defconst tramp-gvfs-path-tramp (concat dbus-path-emacs "/Tramp")
"The preceeding object path for own objects.")
......@@ -145,9 +146,12 @@
(defconst tramp-gvfs-service-daemon "org.gtk.vfs.Daemon"
"The well known name of the GVFS daemon.")
;; Check that GVFS is available.
(unless (dbus-ping :session tramp-gvfs-service-daemon 100)
(throw 'tramp-loading nil))
;; Check that GVFS is available. D-Bus integration is available since
;; Emacs 23 on some system types. We don't call `dbus-ping', because
;; this would load dbus.el.
(unless (and (tramp-compat-funcall 'dbus-get-unique-name :session)
(tramp-compat-process-running-p "gvfs-fuse-daemon"))
(error "Package `tramp-gvfs' not supported"))
(defconst tramp-gvfs-path-mounttracker "/org/gtk/vfs/mounttracker"
"The object path of the GVFS daemon.")
......@@ -385,7 +389,7 @@ Every entry is a list (NAME ADDRESS).")
(expand-file-name . tramp-gvfs-handle-expand-file-name)
;; `file-accessible-directory-p' performed by default handler.
(file-attributes . tramp-gvfs-handle-file-attributes)
(file-directory-p . tramp-smb-handle-file-directory-p)
(file-directory-p . tramp-gvfs-handle-file-directory-p)
(file-executable-p . tramp-gvfs-handle-file-executable-p)
(file-exists-p . tramp-gvfs-handle-file-exists-p)
(file-local-copy . tramp-gvfs-handle-file-local-copy)
......@@ -431,13 +435,15 @@ Every entry is a list (NAME ADDRESS).")
"Alist of handler functions for Tramp GVFS method.
Operations not mentioned here will be handled by the default Emacs primitives.")
(defun tramp-gvfs-file-name-p (filename)
;;;###tramp-autoload
(defsubst tramp-gvfs-file-name-p (filename)
"Check if it's a filename handled by the GVFS daemon."
(and (tramp-tramp-file-p filename)
(let ((method
(tramp-file-name-method (tramp-dissect-file-name filename))))
(and (stringp method) (member method tramp-gvfs-methods)))))
;;;###tramp-autoload
(defun tramp-gvfs-file-name-handler (operation &rest args)
"Invoke the GVFS related OPERATION.
First arg specifies the OPERATION, second arg is a list of arguments to
......@@ -449,8 +455,10 @@ pass to the OPERATION."
;; This might be moved to tramp.el. It shall be the first file name
;; handler.
(add-to-list 'tramp-foreign-file-name-handler-alist
(cons 'tramp-gvfs-file-name-p 'tramp-gvfs-file-name-handler))
;;;###tramp-autoload
(when (featurep 'dbusbind)
(add-to-list 'tramp-foreign-file-name-handler-alist
(cons 'tramp-gvfs-file-name-p 'tramp-gvfs-file-name-handler)))
(defun tramp-gvfs-stringify-dbus-message (message)