]> git.eshelyaron.com Git - emacs.git/commitdiff
(Fload): Handle case where openp finds a magic file
authorKarl Heuer <kwzh@gnu.org>
Sun, 6 Sep 1998 13:57:32 +0000 (13:57 +0000)
committerKarl Heuer <kwzh@gnu.org>
Sun, 6 Sep 1998 13:57:32 +0000 (13:57 +0000)
but it has no `load' handler or that handler calls `load'.
If FOUND != FILE, find FOUND's handler even if inhibited for FILE.

src/lread.c

index 04f34e8869048f43f54463a0ae11229515d5c613..72ebd3589bacb6fae8799722b6ed1d8f4e9facdd 100644 (file)
@@ -649,15 +649,25 @@ Return t if file exists.")
        return Qnil;
     }
 
-  /* If FD is 0, that means openp found a remote file.  */
+  /* If FD is 0, that means openp found a magic file.  */
   if (fd == 0)
     {
-      handler = Ffind_file_name_handler (found, Qload);
-      return call5 (handler, Qload, found, noerror, nomessage, Qt);
+      if (NILP (Fequal (found, file)))
+       /* If FOUND is a different file name from FILE,
+          find its handler even if we have already inhibited
+          the `load' operation on FILE.  */
+       handler = Ffind_file_name_handler (found, Qt);
+      else
+       handler = Ffind_file_name_handler (found, Qload);
+      if (! NILP (handler))
+       return call5 (handler, Qload, found, noerror, nomessage, Qt);
     }
 
+  /* Load .elc files directly, but not when they are
+     remote and have no handler!  */
   if (!bcmp (&(XSTRING (found)->data[XSTRING (found)->size - 4]),
-            ".elc", 4))
+            ".elc", 4)
+      && fd != 0)
     {
       struct stat s1, s2;
       int result;
@@ -687,7 +697,8 @@ Return t if file exists.")
       /* We are loading a source file (*.el).  */
       if (!NILP (Vload_source_file_function))
        {
-         close (fd);
+         if (fd != 0)
+           close (fd);
          return call4 (Vload_source_file_function, found, file,
                        NILP (noerror) ? Qnil : Qt,
                        NILP (nomessage) ? Qnil : Qt);
@@ -2108,7 +2119,7 @@ read1 (readcharfun, pch, first_in_list)
              {
                /* Compute NaN and infinities using 0.0 in a variable,
                   to cope with compilers that think they are smarter
-                  than us.  */
+                  than we are.  */
                double zero = 0.0;
 
                double value;