Next: , Previous: , Up: Usage   [Contents][Index]

5.2 File name completion

File name completion works with TRAMP for completion of method names, of user names and of host names as well as for completion of file names on remote hosts. In order to enable this, partial completion must be activated in your .emacs.

If you, for example, type C-x C-f /t TAB, TRAMP might give you as result the choice for

telnet:
tmp/
toto:

telnet:’ is a possible completion for the respective method, ‘tmp/’ stands for the directory /tmp on your local host, and ‘toto:’ might be a host TRAMP has detected in your ~/.ssh/known_hosts file (given you’re using default method ssh).

If you go on to type e TAB, the minibuffer is completed to ‘/telnet:’. Next TAB brings you all host names TRAMP detects in your /etc/hosts file, let’s say

/telnet:127.0.0.1:
/telnet:192.168.0.1:
/telnet:[::1]:
/telnet:localhost:
/telnet:melancholia.danann.net:
/telnet:melancholia:

Now you can choose the desired host, and you can continue to complete file names on that host.

If the configuration files (see Customizing Completion), which TRAMP uses for analysis of completion, offer user names, those user names will be taken into account as well.

Remote hosts which have been visited in the past and kept persistently (see Connection caching) will be offered too.

Once the remote host identification is completed, it comes to file name completion on the remote host. This works pretty much like for files on the local host, with the exception that minibuffer killing via a double-slash works only on the file name part, except that file name part starts with //. A triple-slash stands for the default behavior.

Example:

C-x C-f /telnet:melancholia:/usr/local/bin//etc TAB
     -| /telnet:melancholia:/etc

C-x C-f /telnet:melancholia://etc TAB
     -| /etc

C-x C-f /telnet:melancholia:/usr/local/bin///etc TAB
     -| /etc

A remote directory might have changed its contents out of Emacs control, for example by creation or deletion of files by other processes. Therefore, during file name completion, the remote directory contents are reread regularly in order to detect such changes, which would be invisible otherwise (see Connection caching).

User Option: tramp-completion-reread-directory-timeout

This variable defines the number of seconds since last remote command before rereading a directory contents. A value of 0 would require an immediate reread during file name completion, nil means to use always cached values for the directory contents.

Next: , Previous: , Up: Usage   [Contents][Index]