GNU Info

Info Node: (tramp)Customizing Completion

(tramp)Customizing Completion


Next: Remote Programs Prev: Customizing Methods Up: Configuration
Enter node , (file) or (file)node

Selecting config files for user/host name completion
====================================================

The variable `tramp-completion-function-alist' is intended to customize
which files are taken into account for user and host name completion
(Note: Filename completion).  For every method, it keeps a set of
configuration files, accompanied by a Lisp function able to parse that
file.  Entries in `tramp-completion-function-alist' have the form
(METHOD PAIR1 PAIR2 ...).

   Each PAIR is composed of (FUNCTION FILE).  FUNCTION is responsible
to extract user names and host names from FILE for completion.  There
are two functions which access this variable:

 - Fonction: tramp-get-completion-function method
     This function returns the list of completion functions for METHOD.

     Example:
          (tramp-get-completion-function "rsh")
          
               => ((tramp-parse-rhosts "/etc/hosts.equiv")
                   (tramp-parse-rhosts "~/.rhosts"))

 - Fonction: tramp-set-completion-function method function-list
     This function sets FUNCTION-LIST as list of completion functions
     for METHOD.

     Example:
          (tramp-set-completion-function "ssh"
           '((tramp-parse-sconfig "/etc/ssh_config")
             (tramp-parse-sconfig "~/.ssh/config")))
          
               => ((tramp-parse-sconfig "/etc/ssh_config")
                   (tramp-parse-sconfig "~/.ssh/config"))

   The following predefined functions parsing configuration files exist:

`tramp-parse-rhosts'
     This function parses files which are syntactical equivalent to
     `~/.rhosts'.  It returns both host names and user names, if
     specified.

`tramp-parse-shosts'
     This function parses files which are syntactical equivalent to
     `~/.ssh/known_hosts'.  Since there are no user names specified in
     such files, it can return host names only.

`tramp-parse-sconfig'
     This function returns the host nicknames defined by `Host' entries
     in `~/.ssh/config' style files.

`tramp-parse-hosts'
     A function dedicated to `/etc/hosts' style files.  It returns host
     names only.

`tramp-parse-passwd'
     A function which parses `/etc/passwd' like files.  Obviously, it
     can return user names only.

`tramp-parse-netrc'
     Finally, a function which parses `~/.netrc' like files.

   If you want to keep your own data in a file, with your own structure,
you might provide such a function as well.  This function must meet the
following conventions:

 - Fonction: my-tramp-parse file
     FILE must be either a file name on your host, or `nil'. The
     function must return a list of (USER HOST), which are taken as
     candidates for user and host name completion.

     Example:
          (my-tramp-parse "~/.my-tramp-hosts")
          
               => ((nil "toto") ("daniel" "melancholia"))


automatically generated by info2www version 1.2.2.9