[Top][All Lists]

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

Re: Interactive `tramp-find-file' command

From: Michael Albinus
Subject: Re: Interactive `tramp-find-file' command
Date: Sun, 20 Aug 2006 18:46:32 +0200
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.50 (gnu/linux)

Reiner Steib <address@hidden> writes:

> Hi,


> I think tramp's file name syntax is quite hard to remember, especially
> for beginners and occasional tramp users.

It depends. I agree with you that the syntax for multi-hop methods in
Tramp 2.0 might be complex. All other parts of a remote file name in
the single-hop mode are supported by input completion.

In Tramp 2.1, there is no multi-hop syntax anymore. Instead of, there
are proxies which must be declared before. That is complex, too. But
it isn't a question of entering a file name interactively.

> WIBNI there was an interactive command prompting for tramp method,
> hostname, username and filename and translates the user input into
> the correct filename syntax (depending on the Emacs flavor)?

For Tramp 2.0, I wouldn't recommend to change it. It is a stable
version, which shouldn't get new features. OTOH, I've broken this rule
several times already, and it might be worth for at least multi-hop
methods ...

For Tramp 2.1, we could consider such a function. But this should also
provide recipes for defining proxies I believe.

> A sketch for a `tramp-find-file' command could look like this:
> ;;;###autoload
> (defun tramp-find-file (method host user file &optional wildcards)
>   ;; doc string
>   (interactive
>    (list
>     (completing-read "Method: "
>                    '(;; (info "(tramp)External transfer methods")

I don't know completing-read pretty well: does this provide a
possibility to enter the manual?

>                      "rcp" "rsh"
>                      "scp" "ssh"
>                      "rsync"
>                      "scpx"
>                      "pscp" "plink"
>                      "fsh" "fcp"
>                      "ftp"
>                      "smb"

Preferably, the methods shall be derived from `tramp-methods'.

>                      ;; (info "(tramp)Multi-hop Methods")
>                      "telnet" "su" "sudo")

Why multi-hop methods? These are also single-hop methods.

>                    nil t
>                    tramp-default-method nil
>                    tramp-default-method)
>     ;; Add suitable completing here:
>     (completing-read "Remote host: " nil)
>     (completing-read "Remote user name: " nil)
>     (completing-read "File: " nil)))

User name, host name and file name completion shall be possible as
offered in `read-file-name'.

>   (let (filename)
>     ;; Construct correct `filename' from `method', `host', `user' and `file'
>     ;; depending on Emacs flavor.
>     ;;
>     ;; Make the result available to the user in a minibuffer prompt so (s)he
>     ;; can learn the file name syntax and edit it.  Put the resulting
>     ;; (confirmed) filename into the file name history.
>     (find-file filename wildcards)))
> ;; Maybe...  (defalias 'find-remote-file 'tramp-find-file)

Maybe not. There are other packages for remote files, so Tramp cannot
declare its uniqueness. Such an alias must be agreed with the
maintainers of (X)Emacs.

> Bye, Reiner.

Best regards, Michael.

reply via email to

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