1588 |
normal Emacs functions.") |
normal Emacs functions.") |
1589 |
|
|
1590 |
;; Handlers for foreign methods, like FTP or SMB, shall be plugged here. |
;; Handlers for foreign methods, like FTP or SMB, shall be plugged here. |
1591 |
(defvar tramp-foreign-file-name-handler-alist nil |
(defvar tramp-foreign-file-name-handler-alist |
1592 |
|
'((identity . tramp-sh-file-name-handler)) |
1593 |
"Alist of elements (FUNCTION . HANDLER) for foreign methods handled specially. |
"Alist of elements (FUNCTION . HANDLER) for foreign methods handled specially. |
1594 |
If (FUNCTION FILENAME) returns non-nil, then all I/O on that file is done by |
If (FUNCTION FILENAME) returns non-nil, then all I/O on that file is done by |
1595 |
calling HANDLER.") |
calling HANDLER.") |
3429 |
;; Main function. |
;; Main function. |
3430 |
;;;###autoload |
;;;###autoload |
3431 |
(defun tramp-file-name-handler (operation &rest args) |
(defun tramp-file-name-handler (operation &rest args) |
3432 |
"Invoke tramp file name handler. |
"Invoke Tramp file name handler. |
3433 |
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." |
3434 |
(save-match-data |
(save-match-data |
3435 |
(let* ((fn (assoc operation tramp-file-name-handler-alist)) |
(let* ((filename (apply 'tramp-file-name-for-operation operation args)) |
|
(filename (apply 'tramp-file-name-for-operation operation args)) |
|
3436 |
(foreign (tramp-find-foreign-file-name-handler filename))) |
(foreign (tramp-find-foreign-file-name-handler filename))) |
3437 |
(cond |
(cond |
3438 |
(foreign (apply foreign operation args)) |
(foreign (apply foreign operation args)) |
|
(fn (apply (cdr fn) args)) |
|
3439 |
(t (tramp-run-real-handler operation args)))))) |
(t (tramp-run-real-handler operation args)))))) |
3440 |
|
|
3441 |
;;;###autoload |
;;;###autoload |
3442 |
(put 'tramp-file-name-handler 'file-remote-p t) ;for file-remote-p |
(put 'tramp-file-name-handler 'file-remote-p t) ;for file-remote-p |
3443 |
|
|
3444 |
|
(defun tramp-sh-file-name-handler (operation &rest args) |
3445 |
|
"Invoke remote-shell Tramp file name handler. |
3446 |
|
Fall back to normal file name handler if no Tramp handler exists." |
3447 |
|
(save-match-data |
3448 |
|
(let ((fn (assoc operation tramp-file-name-handler-alist))) |
3449 |
|
(if fn |
3450 |
|
(apply (cdr fn) args) |
3451 |
|
(tramp-run-real-handler operation args))))) |
3452 |
|
|
3453 |
;;;###autoload |
;;;###autoload |
3454 |
(defun tramp-completion-file-name-handler (operation &rest args) |
(defun tramp-completion-file-name-handler (operation &rest args) |
3455 |
"Invoke tramp file name completion handler. |
"Invoke tramp file name completion handler. |