An Emacs package that allows a more permissive syntax for TRAMP paths.
It deals with how cumbersome it is for users to have to precise, when prompted for a path, the /<method>:
prefix even though vars tramp-default-method
and tramp-default-method-alist
exist.
It provides function friendly-tramp-path-dissect
that is a drop-in replacement for tramp-dissect-file-name
. It behaves the same but allows the following formats:
/<method>:[<user>[%<domain>]@]<host>[%<port>][:<localname>]
(regular TRAMP format)[<user>[%<domain>]@]<host>[%<port>][:<localname>]
(permissive format)
The package is available on Melpa.
With use-package
:
(use-package friendly-tramp-path
:after tramp)
Manually:
M-x package-install friendly-tramp-path
Convert a path in permissive format to a TRAMP VEC:
(let* ((path "pi@raspberry:/home/pi/"))
(friendly-tramp-path-dissect vec))
Convert a path in permissive format back into regular TRAMP format:
(let* ((path "pi@raspberry:/home/pi/")
(vec (friendly-tramp-path-dissect vec))
(method (tramp-file-name-method vec))
(user (tramp-file-name-user vec))
(domain (tramp-file-name-domain vec))
(host (tramp-file-name-host vec))
(port (tramp-file-name-port vec))
(localname (tramp-file-name-localname vec)))
(tramp-make-tramp-file-name method user domain host port localname))