emacs-devel
[Top][All Lists]
Advanced

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

Re: Tramp and auto-compression-mode and load order


From: Stefan Monnier
Subject: Re: Tramp and auto-compression-mode and load order
Date: Wed, 21 Nov 2001 08:18:18 -0500

> It works to load Tramp first, then turn on auto-compression-mode
> later.  But it does not work to turn on auto-compression-mode first,
> then load Tramp.

Last time this came up I suggested to choose entries based on where
they match.  F.ex. jka-compr matches the end of the file name,
so it should have precedence over ange-ftp and tramp.

The idea behind it is that when a file-name-handler does its
thing, it takes the file, splits it into /before/middle/after
(where `middle' is typically the part that the file-name-handler's
regex matched) and then it passes `after' to some non-file operations
(f.ex. to an FTP subprocess or to gzip) and it passes `before' back to
some file-operations.

I came up with the patch below as a first cut.  Can you try it out ?


        Stefan


Index: fileio.c
===================================================================
RCS file: /cvs/emacs/src/fileio.c,v
retrieving revision 1.428
diff -u -r1.428 fileio.c
--- fileio.c    2001/11/19 21:50:44     1.428
+++ fileio.c    2001/11/21 13:17:33
@@ -336,7 +336,8 @@
      Lisp_Object filename, operation;
 {
   /* This function must not munge the match data.  */
-  Lisp_Object chain, inhibited_handlers;
+  Lisp_Object chain, inhibited_handlers, result = Qnil;
+  int pos = -1;
 
   CHECK_STRING (filename);
 
@@ -353,21 +354,26 @@
       if (CONSP (elt))
        {
          Lisp_Object string;
+         int match_pos;
          string = XCAR (elt);
-         if (STRINGP (string) && fast_string_match (string, filename) >= 0)
+         if (STRINGP (string)
+             && (match_pos = fast_string_match (string, filename)) > pos)
            {
              Lisp_Object handler, tem;
 
              handler = XCDR (elt);
              tem = Fmemq (handler, inhibited_handlers);
              if (NILP (tem))
-               return handler;
+               {
+                 result = handler;
+                 pos = match_pos;
+               }
            }
        }
 
       QUIT;
     }
-  return Qnil;
+  return result;
 }
 
 DEFUN ("file-name-directory", Ffile_name_directory, Sfile_name_directory,




reply via email to

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