tramp-devel
[Top][All Lists]
Advanced

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

Hi,

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---
;;;###autoload
(defun tramp-find-file (method host user file &optional wildcards)
  ;; doc string
  (interactive
   (list
    (completing-read "Method: "
                     '(;; (info "(tramp)External transfer methods")
                       "rcp" "rsh"
                       "scp" "ssh"
                       "rsync"
                       "scpx"
                       "pscp" "plink"
                       "fsh" "fcp"
                       "ftp"
                       "smb"
                       ;; (info "(tramp)Multi-hop Methods")
                       "telnet" "su" "sudo")
                     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)))
  (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  |  http://rsteib.home.pages.de/





reply via email to

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