Skip to content

📡 More friendly (permissive) TRAMP path constructions for us humans

License

Notifications You must be signed in to change notification settings

p3r7/friendly-tramp-path

Repository files navigation

friendly-tramp-path MELPA

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)

Installation

The package is available on Melpa.

With use-package:

(use-package friendly-tramp-path
  :after tramp)

Manually:

M-x package-install friendly-tramp-path

Example usage

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))

About

📡 More friendly (permissive) TRAMP path constructions for us humans

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published