103 |
(unless (featurep 'xemacs) |
(unless (featurep 'xemacs) |
104 |
(eval-after-load "tramp" |
(eval-after-load "tramp" |
105 |
'(require 'tramp-ftp))) |
'(require 'tramp-ftp))) |
106 |
(autoload 'tramp-ftp-file-name-p "tramp-ftp" |
(eval-after-load "tramp" |
107 |
"Check if it's a filename that should be forwarded to tramp-ftp.") |
'(require 'tramp-smb)) |
108 |
|
|
109 |
(eval-when-compile |
(eval-when-compile |
110 |
(require 'cl) |
(require 'cl) |
1626 |
mentioned here will be handled by `tramp-file-name-handler-alist' or the |
mentioned here will be handled by `tramp-file-name-handler-alist' or the |
1627 |
normal Emacs functions.") |
normal Emacs functions.") |
1628 |
|
|
1629 |
|
;; Handlers for foreign methods, like FTP or SMB, shall be plugged here. |
1630 |
|
(defvar tramp-foreign-file-name-handler-alist nil |
1631 |
|
"Alist of elements (FUNCTION . HANDLER) for foreign methods handled specially. |
1632 |
|
If (FUNCTION FILENAME) returns non-nil, then all I/O on that file is done by |
1633 |
|
calling HANDLER.") |
1634 |
|
|
1635 |
;;; Internal functions which must come first. |
;;; Internal functions which must come first. |
1636 |
|
|
1637 |
(defsubst tramp-message (level fmt-string &rest args) |
(defsubst tramp-message (level fmt-string &rest args) |
3327 |
'dired-shell-unhandle-file-name 'dired-uucode-file |
'dired-shell-unhandle-file-name 'dired-uucode-file |
3328 |
'insert-file-contents-literally 'recover-file |
'insert-file-contents-literally 'recover-file |
3329 |
'vm-imap-check-mail 'vm-pop-check-mail 'vm-spool-check-mail)) |
'vm-imap-check-mail 'vm-pop-check-mail 'vm-spool-check-mail)) |
3330 |
(nth 0 args)) |
(expand-file-name (nth 0 args))) |
3331 |
; FILE DIRECTORY resp FILE1 FILE2 |
; FILE DIRECTORY resp FILE1 FILE2 |
3332 |
((member operation |
((member operation |
3333 |
(list 'add-name-to-file 'copy-file 'expand-file-name |
(list 'add-name-to-file 'copy-file 'expand-file-name |
3337 |
'dired-make-relative-symlink |
'dired-make-relative-symlink |
3338 |
'vm-imap-move-mail 'vm-pop-move-mail 'vm-spool-move-mail)) |
'vm-imap-move-mail 'vm-pop-move-mail 'vm-spool-move-mail)) |
3339 |
(save-match-data |
(save-match-data |
3340 |
(if (string-match tramp-file-name-regexp (nth 0 args)) |
(cond |
3341 |
(nth 0 args) (nth 1 args)))) |
((string-match tramp-file-name-regexp (nth 0 args)) (nth 0 args)) |
3342 |
|
((string-match tramp-file-name-regexp (nth 1 args)) (nth 1 args)) |
3343 |
|
(t (buffer-file-name (current-buffer)))))) |
3344 |
; START END FILE |
; START END FILE |
3345 |
((eq operation 'write-region) |
((eq operation 'write-region) |
3346 |
(nth 2 args)) |
(nth 2 args)) |
3360 |
; unknown file primitive |
; unknown file primitive |
3361 |
(t (error "unknown file I/O primitive: %s" operation)))) |
(t (error "unknown file I/O primitive: %s" operation)))) |
3362 |
|
|
3363 |
|
(defun tramp-find-foreign-file-name-handler (filename) |
3364 |
|
"Return foreign file name handler if exists." |
3365 |
|
(let (elt res) |
3366 |
|
(dolist (elt tramp-foreign-file-name-handler-alist res) |
3367 |
|
(when (funcall (car elt) filename) |
3368 |
|
(setq res (cdr elt)))) |
3369 |
|
res)) |
3370 |
|
|
3371 |
;; Main function. |
;; Main function. |
3372 |
;;;###autoload |
;;;###autoload |
3373 |
(defun tramp-file-name-handler (operation &rest args) |
(defun tramp-file-name-handler (operation &rest args) |
3374 |
"Invoke tramp file name handler. |
"Invoke tramp file name handler. |
3375 |
Falls back to normal file name handler if no tramp file name handler exists." |
Falls back to normal file name handler if no tramp file name handler exists." |
3376 |
(save-match-data |
(save-match-data |
3377 |
(let ((fn (assoc operation tramp-file-name-handler-alist)) |
(let* ((fn (assoc operation tramp-file-name-handler-alist)) |
3378 |
(filename (apply 'tramp-file-name-for-operation operation args))) |
(filename (apply 'tramp-file-name-for-operation operation args)) |
3379 |
|
(foreign (tramp-find-foreign-file-name-handler filename))) |
3380 |
(cond |
(cond |
3381 |
((and tramp-unified-filenames fn (tramp-ftp-file-name-p filename)) |
(foreign (apply foreign operation args)) |
|
(apply 'tramp-ftp-file-name-handler operation args)) |
|
3382 |
(fn (apply (cdr fn) args)) |
(fn (apply (cdr fn) args)) |
3383 |
(t (tramp-run-real-handler operation args)))))) |
(t (tramp-run-real-handler operation args)))))) |
3384 |
|
|
6409 |
;; connect to host "blabla" already if that host is unique. No idea |
;; connect to host "blabla" already if that host is unique. No idea |
6410 |
;; how to suppress. Maybe not an essential problem. |
;; how to suppress. Maybe not an essential problem. |
6411 |
;; ** Try to avoid usage of `last-input-event' in `tramp-completion-mode'. |
;; ** Try to avoid usage of `last-input-event' in `tramp-completion-mode'. |
|
;; ** Handle quoted file names, starting with "/:". Problem is that |
|
|
;; `file-name-non-special' calls later on `file-name-all-completions' |
|
|
;; without ":". Hmm. Worth a bug report? |
|
6412 |
;; ** Extend `tramp-get-completion-su' for NIS and shadow passwords. |
;; ** Extend `tramp-get-completion-su' for NIS and shadow passwords. |
6413 |
;; ** Unify `tramp-parse-{rhosts,shosts,hosts,passwd,netrc}'. |
;; ** Unify `tramp-parse-{rhosts,shosts,hosts,passwd,netrc}'. |
6414 |
;; Code is nearly identical. |
;; Code is nearly identical. |