emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Change Tramp syntax


From: Michael Albinus
Subject: Re: Change Tramp syntax
Date: Sun, 12 Mar 2017 10:10:28 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

Stefan Monnier <address@hidden> writes:

Hi Stefan,

> I don't understand this either.  Currently I see two Tramp entries in
> f-n-h-alist:
>
>  ("\\`/[^/]*\\'" . tramp-completion-file-name-handler)
>  ("^/\\(\\(?:\\(?:\\([a-zA-Z_0-9-]+\\):\\)?\\(?:\\([^/|:      
> ]+\\)@\\)?\\(\\(?:[a-zA-Z0-9_.-]+\\|\\[\\(?:\\(?:\\(?:[a-zA-Z0-9]+\\)?:\\)+[a-zA-Z0-9.]+\\)?]\\)\\(?:#[0-9]+\\)?\\)?|\\)+\\)?\\(?:\\([a-zA-Z_0-9-]+\\):\\)?\\(?:\\([^/|:
>         
> ]+\\)@\\)?\\(\\(?:[a-zA-Z0-9_.-]+\\|\\[\\(?:\\(?:\\(?:[a-zA-Z0-9]+\\)?:\\)+[a-zA-Z0-9.]+\\)?]\\)\\(?:#[0-9]+\\)?\\)?:\\(.*$\\)"
>  . tramp-file-name-handler)
>
> Neither of those regexps seems to handle an /ssh: prefix differently
> from a /host: prefix.

The first file name handler is intended to perform method, user name and
host name completion. It offers only handlers for `expand-file-name',
`file-name-all-completions' and `file-name-completion', everything else
will be handled either by `tramp-file-name-handler' (if the regexp
matches that handler), or by the native file name operation. In
`tramp-completion-handle-file-name-all-completions' it checks for both
possibilities, "/ssh:" and "/host:".

The second file name handler is intended to handle everything else. It
also performs a check, that a host name is not a method. But this is not
part of the regexp; this check is performed in
`tramp-maybe-open-connection', when a remote connection is being opened.

It would be preferable to extend the second regexp such a way, that
remote file names like "/ssh:whatever" are not allowed. But this is not
possible, because the method names to be excluded as host names are not
known at the time this file name handler is installed in
`file-name-handler-alist'.

If we discard ange-ftp syntax, the two entries would look like

("\\`/\\(-:\\)?[^:]*\\'" . tramp-completion-file-name-handler)

("\\`/[a-zA-Z_0-9-]+:\\([^/|: address@hidden)?[a-zA-Z0-9_.-]+:"
;;    method            user name      host name
 . tramp-file-name-handler)

The two regexps don't overlap any longer, which is the key.

Of course, the second regexp must be more complex, due to the multi-hop
syntax, due to Samba domains, due to IPv6 addresses, and due to port
numbers. But you see the idea.

>         Stefan

Best regards, Michael.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]