tramp-devel
[Top][All Lists]
Advanced

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

compatibility with cygwin-mount


From: Matt Swift
Subject: compatibility with cygwin-mount
Date: Mon, 15 Sep 2003 19:25:47 -0400
User-agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3 (gnu/linux)

The patch to tramp.el in the old email copied below prevents
cygwin-mount on NTEmacs from working on filenames like "/usr", which
(with a typical Cygwin setup) should load "c:/cygwin/usr".  Although
it is not a remote file name, Tramp handles that filename before
cygwin-mount gets a chance to and inhibits the handling by
cygwin-mount that we want.

In any case, I think that the original reason for this patch does not
apply any more: the regexp cygwin-mount uses is
"^/[^:@]*$\\|^/|/[^/:]+\\(\\'\\|/\\)" which I think would never match
a standard Tramp remote name.  So perhaps undoing the patch is the
right thing now.

If there is still a problem with remote files being handled by
cygwin-mount, however, I think the best solution (short of a revision
of file-handler conventions that does more bookkeeping so that
handlers can be more intelligent) is simply for tramp to refrain from
inhibiting cygwin-mount when the filename does not match
`tramp-file-name-regexp'.  Maybe doing that is not as simple as it
sounds -- it isn't quite easy enough for me to do it immediately and
include the patch (can one assume that (car args) is the right thing
to check?).

(By the way, I don't agree with the opinion that cygwin-mount should
refrain from handling remote files: cygwin-mount doesn't know anything
about what is or is not a remote file, so I don't see why, if there
absolutely must be code that deals explicitly with the combination of
cygwin-mount+tramp, that the code ought to be in cygwin-mount any more
than it ought to be in tramp.)

Alternatively, it is enough in this case to ensure
`cygwin-mount-name-hook-function' is earlier in
`file-name-handler-alist' than the tramp-completion entry; then things
work well with tramp.el as it is.  I suppose one way to solve things
in tramp.el is to do the same "repair" trick as done for jka-compr if
cygwin-mount is already loaded, and to issue an "afterload" that does
the same thing if cygwin-mount is loaded later.



----------responding to this earlier message in tramp-devel:

    From:       Kai Gro├čjohann  
    Subject:    Re: tramp and cygwin-mount      
    Date:       Thu, 05 Dec 2002 10:29:09 +0100

> I've decided to try and get my NTEmacs working nicely once and for
> all. This includes, amongst other things, getting tramp and
> cygwin-mount to play nicely together.  Currently, when tramp connects
> to the remote host (via sshx in my case), it tries to test for the
> existence of several paths/files, but somehow, the paths/files end up
> getting expanded by the cygwin-mount package and try to test for local
> cygwin dirs on the remote host.
>
> I've figured out how to get the emacs debugger working and think I've
> found where the two get entangled.  About 10 lines into
> tramp-handle-expand-file-name, there is a call to
> (tramp-run-real-handler 'expand-file-name (list name nil)).  In the
> debugger, it shows that expand-file-name has a hook which calls
> cygwin-mount-name-hook-function which then bungles up the file name
> (i.e. ~ expands to my home directory on the local machine even though
> tramp is ssh'ed into a remote machine and is sending commands over
> there).
>
> This is where the limits of my understanding of tramp and emacs and
> lisp hit the wall.  Is there any way to allow tramp to make the call
> to expand-file-name without the cygwin hook?

IMHO, cygwin-mount should abstain from handling these files.  But
maybe it is easier to include a simple workaround for this in Tramp;
then we don't have to wait for cygwin-mount to be fixed.

What's the value of file-name-handler-alist?  Then I will extend
tramp-run-real-handler to remove the cygwin-mount entry.

Hm.  I've now looked at the cygwin-mount source code, and maybe the
following patch does something useful?  Please try it and tell me
what you see.

cvs server: Diffing .
cvs server: Diffing contrib
cvs server: Diffing lisp
Index: lisp/ChangeLog
===================================================================
RCS file: /cvsroot/tramp/tramp/lisp/ChangeLog,v
retrieving revision 2.260
diff -u -r2.260 ChangeLog
--- lisp/ChangeLog      5 Dec 2002 09:21:05 -0000       2.260
+++ lisp/ChangeLog      5 Dec 2002 09:28:27 -0000
@@ -1,5 +1,11 @@
 2002-12-05  Kai Gro├čjohann  <address@hidden>
 
+       * tramp.el (tramp-run-real-handler) 
+       (tramp-completion-run-real-handler): Disable cygwin-mount, too.
+       All files handled by Tramp are on Unix systems, where
+       cygwin-mount is not useful.  (Ie, remote Cygwin systems are not
+       supported.)
+
        * tramp-vc.el (tramp-vc-do-command): Ensure that `okstatus' is an
        integer before using `<' on it.
        (tramp-vc-do-command-new): Pass relative filename as arg to remote
Index: lisp/tramp.el
===================================================================
RCS file: /cvsroot/tramp/tramp/lisp/tramp.el,v
retrieving revision 2.258
diff -u -r2.258 tramp.el
--- lisp/tramp.el       30 Nov 2002 22:33:34 -0000      2.258
+++ lisp/tramp.el       5 Dec 2002 09:28:39 -0000
@@ -3282,10 +3282,13 @@
 First arg specifies the OPERATION, second arg is a list of arguments to
 pass to the OPERATION."
   (let* ((inhibit-file-name-handlers
-         (cons 'tramp-file-name-handler
-               (cons 'tramp-completion-file-name-handler
-                     (and (eq inhibit-file-name-operation operation)
-                          inhibit-file-name-handlers))))
+         `(tramp-file-name-handler
+           tramp-completion-file-name-handler
+           cygwin-mount-name-hook-function
+           cygwin-mount-map-drive-hook-function
+           .
+           ,(and (eq inhibit-file-name-operation operation)
+                 inhibit-file-name-handlers)))
         (inhibit-file-name-operation operation))
     (apply operation args)))
 
@@ -3298,9 +3301,12 @@
 First arg specifies the OPERATION, second arg is a list of arguments to
 pass to the OPERATION."
   (let* ((inhibit-file-name-handlers
-         (cons 'tramp-completion-file-name-handler
-               (and (eq inhibit-file-name-operation operation)
-                    inhibit-file-name-handlers)))
+         `(tramp-completion-file-name-handler
+           cygwin-mount-name-hook-function
+           cygwin-mount-map-drive-hook-function
+           .
+           ,(and (eq inhibit-file-name-operation operation)
+                 inhibit-file-name-handlers)))
         (inhibit-file-name-operation operation))
     (apply operation args)))
 




reply via email to

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