From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Kai.Grossjohann@CS.Uni-Dortmund.DE (Kai =?iso-8859-15?q?Gro=DFjohann?=) Newsgroups: gmane.emacs.devel Subject: Re: Integrate Tramp Date: Thu, 20 Jun 2002 17:51:24 +0200 Sender: emacs-devel-admin@gnu.org Message-ID: References: <200206171631.g5HGVBM13861@aztec.santafe.edu> <200206190223.g5J2NlQ15963@aztec.santafe.edu> <200206201434.g5KEYru18709@aztec.santafe.edu> NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1024588480 28864 127.0.0.1 (20 Jun 2002 15:54:40 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Thu, 20 Jun 2002 15:54:40 +0000 (UTC) Cc: miles@gnu.org, emacs-devel@gnu.org Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.33 #1 (Debian)) id 17L4Ge-0007VR-00 for ; Thu, 20 Jun 2002 17:54:40 +0200 Original-Received: from fencepost.gnu.org ([199.232.76.164]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 17L4iO-0001KN-00 for ; Thu, 20 Jun 2002 18:23:20 +0200 Original-Received: from localhost ([127.0.0.1] helo=fencepost.gnu.org) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 17L4GM-0001oU-00; Thu, 20 Jun 2002 11:54:22 -0400 Original-Received: from waldorf.cs.uni-dortmund.de ([129.217.4.42]) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 17L4Db-0001cS-00; Thu, 20 Jun 2002 11:51:31 -0400 Original-Received: from lothlorien.cs.uni-dortmund.de (lothlorien [129.217.19.67]) by waldorf.cs.uni-dortmund.de with ESMTP id g5KFpTb26784; Thu, 20 Jun 2002 17:51:29 +0200 (MES) Original-Received: from lucy.cs.uni-dortmund.de (lucy [129.217.19.80]) by lothlorien.cs.uni-dortmund.de id RAA14376; Thu, 20 Jun 2002 17:51:24 +0200 (MET DST) Original-Received: by lucy.cs.uni-dortmund.de (Postfix, from userid 6104) id 3AB023B5E2; Thu, 20 Jun 2002 17:51:24 +0200 (CEST) Original-To: rms@gnu.org In-Reply-To: <200206201434.g5KEYru18709@aztec.santafe.edu> (Richard Stallman's message of "Thu, 20 Jun 2002 08:34:53 -0600 (MDT)") Original-Lines: 67 User-Agent: Gnus/5.090007 (Oort Gnus v0.07) Emacs/21.3.50 (i686-pc-linux-gnu) Errors-To: emacs-devel-admin@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.0.9 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.devel:5017 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:5017 Richard Stallman writes: > I suspect that whether you wanth to use tramp or ftp depends on both the > machine and the user; I would be happy with a variable that let me > specify mappings from these to the method to use (plus a default for > otherwise unspecified machines, of course). > > I think we need to implement this now, before the next release, > because having two alternative syntaxes for remote file names is not a > coherent interface. It is usable for wizards, but not clean and nice. I have now written some code which hooks into Ange-FTP. For some filenames, the Tramp functions instead of the Ange-FTP functions are called. (This is intended as a proof of concept, some changes would be needed before it's included with Tramp. It's not nice style to just redefine the ange-ftp function...) (require 'ange-ftp) (defvar tramp-override-ange-ftp-alist '(("grossjoh@schulz" "sm")) "*Use Tramp for these Ange-FTP filenames. Elements are (TARGET METHOD) where TARGET is a string of the form \"USER@HOST\" and METHOD is a Tramp method name (also a string).") (defun ange-ftp-hook-function (operation &rest args) (let* ((fn (get operation 'ange-ftp)) (parsed-name (ange-ftp-ftp-name (car args))) (host (and parsed-name (nth 0 parsed-name))) (user (and parsed-name (nth 1 parsed-name))) (path (and parsed-name (nth 2 parsed-name))) (method (and user host (assoc (format "%s@%s" user host) tramp-override-ange-ftp-alist)))) (cond (method ;; Invoke Tramp instead of Ange-FTP. (apply 'tramp-file-name-handler operation (cons (tramp-make-tramp-file-name nil (cadr method) user host path) (cdr args)))) (fn (save-match-data (apply fn args))) (t (ange-ftp-run-real-handler operation args))))) With the example value for tramp-override-ange-ftp-alist, all filenames starting with "/grossjoh@schulz:" will be handled by Tramp (using the "sm" method). However, internally, Tramp still uses the old filenames. This means that hitting C-x C-f in a buffer visiting a file via Tramp will still show "/[sm/grossjoh@schulz]" (plus some suffix) instead of "/grossjoh@schulz:" (plus some suffix). The other alternative would be to change Tramp to use a filename format that's similar to the format used by Ange-FTP and to call Ange-FTP for some user/host combinations if the method is not specified. This would entail removing ange-ftp from file-name-handler-alist, I guess. It would also mean that all Tramp filenames should use the Ange-FTP `style'. What do you think? kai -- A large number of young women don't trust men with beards. (BFBS Radio)