[Top][All Lists]

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

Interactive `tramp-find-file' command

From: Reiner Steib
Subject: Interactive `tramp-find-file' command
Date: Sat, 19 Aug 2006 13:08:41 +0200
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.50 (gnu/linux)


I think tramp's file name syntax is quite hard to remember, especially
for beginners and occasional tramp users.  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)?

A sketch for a `tramp-find-file' command could look like this:

--8<---------------cut here---------------start------------->8---
(defun tramp-find-file (method host user file &optional wildcards)
  ;; doc string
    (completing-read "Method: "
                     '(;; (info "(tramp)External transfer methods")
                       "rcp" "rsh"
                       "scp" "ssh"
                       "pscp" "plink"
                       "fsh" "fcp"
                       ;; (info "(tramp)Multi-hop Methods")
                       "telnet" "su" "sudo")
                     nil t
                     tramp-default-method nil
    ;; Add suitable completing here:
    (completing-read "Remote host: " nil)
    (completing-read "Remote user name: " nil)
    (completing-read "File: " nil)))
  (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)
--8<---------------cut here---------------end--------------->8---

Bye, Reiner.
      (o o)
---ooO-(_)-Ooo---  |  PGP key available  |

reply via email to

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