3454 |
;; `tramp-completion-file-name-regexp-unified' aren't different. |
;; `tramp-completion-file-name-regexp-unified' aren't different. |
3455 |
;; If nil, `tramp-completion-run-real-handler' is called (i.e. forwarding to |
;; If nil, `tramp-completion-run-real-handler' is called (i.e. forwarding to |
3456 |
;; `tramp-file-name-handler'). Otherwise, it takes `tramp-run-real-handler'. |
;; `tramp-file-name-handler'). Otherwise, it takes `tramp-run-real-handler'. |
3457 |
;; Using `last-input-char' is a little bit risky, because completing a file |
;; Using `last-input-event' is a little bit risky, because completing a file |
3458 |
;; might require loading other files, like "~/.netrc", and for them it |
;; might require loading other files, like "~/.netrc", and for them it |
3459 |
;; shouldn't be decided based on that variable. On the other hand, those files |
;; shouldn't be decided based on that variable. On the other hand, those files |
3460 |
;; shouldn't have partial tramp file name syntax. Maybe another variable should |
;; shouldn't have partial tramp file name syntax. Maybe another variable should |
3473 |
file) |
file) |
3474 |
(member (match-string 1 file) |
(member (match-string 1 file) |
3475 |
(cons tramp-ftp-method (mapcar 'car tramp-methods)))) |
(cons tramp-ftp-method (mapcar 'car tramp-methods)))) |
3476 |
((or (equal last-input-char 'tab) |
((or (equal last-input-event 'tab) |
3477 |
(and (integerp last-input-char) |
(and (not (event-modifiers last-input-event)) |
3478 |
(or (char-equal last-input-char ?\?) |
(integerp last-input-event) |
3479 |
(or (char-equal last-input-char ?\t) ; handled by 'tab already? |
(or (char-equal last-input-event ?\?) |
3480 |
(char-equal last-input-char ?\ ))))) |
(char-equal last-input-event ?\t) ; handled by 'tab already? |
3481 |
|
(char-equal last-input-event ?\ )))) |
3482 |
t))) |
t))) |
3483 |
|
|
3484 |
(defun tramp-completion-handle-file-exists-p (filename) |
(defun tramp-completion-handle-file-exists-p (filename) |
3703 |
(mapcar |
(mapcar |
3704 |
'(lambda (method) |
'(lambda (method) |
3705 |
(and method |
(and method |
3706 |
(<= (length partial-method) (length method)) |
(string-match (concat "^" (regexp-quote partial-method)) method) |
3707 |
(string-equal |
;; we must remove leading "/". |
|
partial-method (substring method 0 (length partial-method))) |
|
3708 |
(substring (tramp-make-tramp-file-name nil method nil nil nil) 1))) |
(substring (tramp-make-tramp-file-name nil method nil nil nil) 1))) |
3709 |
|
|
3710 |
(add-to-list 'all-methods |
(add-to-list 'all-methods |
3715 |
"Returns the most expanded string for user and host name completion. |
"Returns the most expanded string for user and host name completion. |
3716 |
PARTIAL-USER must match USER, PARTIAL-HOST must match HOST." |
PARTIAL-USER must match USER, PARTIAL-HOST must match HOST." |
3717 |
(cond |
(cond |
3718 |
|
|
3719 |
((and partial-user partial-host) |
((and partial-user partial-host) |
3720 |
(unless |
(if (and host |
3721 |
(and user host |
(string-match (concat "^" (regexp-quote partial-host)) host) |
3722 |
(<= (length partial-user) (length user)) |
(string-equal partial-user (or user partial-user))) |
3723 |
(string-equal |
(setq user partial-user) |
|
partial-user (substring user 0 (length partial-user))) |
|
|
(<= (length partial-host) (length host)) |
|
|
(string-equal |
|
|
partial-host (substring host 0 (length partial-host)))) |
|
3724 |
(setq user nil |
(setq user nil |
3725 |
host nil))) |
host nil))) |
3726 |
|
|
3727 |
(partial-user |
(partial-user |
3728 |
(setq host nil) |
(setq host nil) |
3729 |
(unless |
(unless |
3730 |
(and user |
(and user (string-match (concat "^" (regexp-quote partial-user)) user)) |
|
(<= (length partial-user) (length user)) |
|
|
(string-equal |
|
|
partial-user (substring user 0 (length partial-user)))) |
|
3731 |
(setq user nil))) |
(setq user nil))) |
3732 |
|
|
3733 |
(partial-host |
(partial-host |
3734 |
(setq user nil) |
(setq user nil) |
3735 |
(unless |
(unless |
3736 |
(and host |
(and host (string-match (concat "^" (regexp-quote partial-host)) host)) |
|
(<= (length partial-host) (length host)) |
|
|
(string-equal |
|
|
partial-host (substring host 0 (length partial-host)))) |
|
3737 |
(setq host nil))) |
(setq host nil))) |
3738 |
|
|
3739 |
(t (setq user nil |
(t (setq user nil |
3740 |
host nil))) |
host nil))) |
3741 |
|
|
3742 |
(when (or user host) |
(when (or user host) |
3743 |
|
;; we must remove leading "/". |
3744 |
(substring (tramp-make-tramp-file-name nil method user host nil) 1))) |
(substring (tramp-make-tramp-file-name nil method user host nil) 1))) |
3745 |
|
|
3746 |
;; This function isn't as good as it should because necessary information is |
;; This function isn't as good as it should because necessary information is |
6350 |
;; about Tramp, it does not do the right thing if the target file |
;; about Tramp, it does not do the right thing if the target file |
6351 |
;; name is a Tramp name. |
;; name is a Tramp name. |
6352 |
;; * Username and hostname completion. |
;; * Username and hostname completion. |
6353 |
|
;; ** If `partial-completion-mode' isn't loaded, "/foo:bla" tries to |
6354 |
|
;; connect to host "blabla" already if that host is unique. No idea |
6355 |
|
;; how to suppress. Maybe not an essential problem. |
6356 |
|
;; ** For "/ssh1-old:", `(file-name-all-completions "ssh1" "/")' is called |
6357 |
|
;; only. Likely due to word delimeter property of "-". Maybe we can remove |
6358 |
|
;; all the "*-old" methods? Or rename them to "*_old"? |
6359 |
|
;; ** Write documentation for "tramp.texi". |
6360 |
|
;; ** Extend `tramp-get-completion-su' for NIS and shadow passwords. |
6361 |
|
;; ** Unify `tramp-get-completion-{rsh,ssh,telnet,su}' and |
6362 |
|
;; `tramp-parse-{rhosts,shosts,hosts,passwd}'. Code is nearly identical. |
6363 |
|
;; ** Decide whiche files to take for searching user/host names depending on |
6364 |
|
;; operating system (w32!). |
6365 |
|
;; ** Make files to be used for searching user/host names |
6366 |
|
;; configurable. Something like |
6367 |
|
;; ("ssh" ('tramp-parse-rhosts "/etc/hosts.equiv") |
6368 |
|
;; ('tramp-parse-rhosts "/etc/shosts.equiv") |
6369 |
|
;; ('tramp-parse-shosts "/etc/ssh_known_hosts") |
6370 |
|
;; ('tramp-parse-rhosts "~/.rhosts") |
6371 |
|
;; ('tramp-parse-rhosts "~/.shosts") |
6372 |
|
;; ('tramp-parse-shosts "~/.ssh/known_hosts")) |
6373 |
|
;; ** Enhance variables for debug. |
6374 |
|
;; ** Implement "/multi:" completion. |
6375 |
|
;; ** Add a learning mode for completion. Make results persistent. |
6376 |
|
|
6377 |
;; Functions for file-name-handler-alist: |
;; Functions for file-name-handler-alist: |
6378 |
;; diff-latest-backup-file -- in diff.el |
;; diff-latest-backup-file -- in diff.el |