]> code.delx.au - gnu-emacs/blobdiff - src/lread.c
(LD_SWITCH_MACHINE):
[gnu-emacs] / src / lread.c
index 5b4cd3e748f9bf1abb8c715bfca22274e0690a81..60583bafbb27ccb6e69b91df81b17b0418fad740 100644 (file)
@@ -1,6 +1,6 @@
 /* Lisp parsing and input streams.
-   Copyright (C) 1985, 1986, 1987, 1988, 1989, 
-   1993, 1994, 1995 Free Software Foundation, Inc.
+   Copyright (C) 1985, 86, 87, 88, 89, 93, 94, 95, 1997
+      Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -95,6 +95,9 @@ Lisp_Object Vload_history;
 /* This is used to build the load history. */
 Lisp_Object Vcurrent_load_list;
 
+/* List of files that were preloaded.  */
+Lisp_Object Vpreloaded_file_list;
+
 /* Name of file actually being read by `load'.  */
 Lisp_Object Vload_file_name;
 
@@ -501,6 +504,9 @@ Return t if file exists.")
       error ("Failure to create stdio stream for %s", XSTRING (file)->data);
     }
 
+  if (! NILP (Vpurify_flag))
+    Vpreloaded_file_list = Fcons (file, Vpreloaded_file_list);
+
   if (NILP (nomessage))
     {
       if (newer)
@@ -2033,10 +2039,7 @@ intern (str)
   tem = oblookup (obarray, str, len);
   if (SYMBOLP (tem))
     return tem;
-  return Fintern ((!NILP (Vpurify_flag)
-                  ? make_pure_string (str, len)
-                  : make_string (str, len)),
-                 obarray);
+  return Fintern (make_string (str, len), obarray);
 }
 
 /* Create an uninterned symbol with name STR.  */
@@ -2076,6 +2079,9 @@ it defaults to the value of `obarray'.")
   sym = Fmake_symbol (string);
   XSYMBOL (sym)->obarray = obarray;
 
+  if (XSTRING (string)->data[0] == ':')
+    XSYMBOL (sym)->value = sym;
+
   ptr = &XVECTOR (obarray)->contents[XINT (tem)];
   if (SYMBOLP (*ptr))
     XSYMBOL (sym)->next = XSYMBOL (*ptr);
@@ -2242,7 +2248,7 @@ map_obarray (obarray, fn, arg)
   for (i = XVECTOR (obarray)->size - 1; i >= 0; i--)
     {
       tail = XVECTOR (obarray)->contents[i];
-      if (XFASTINT (tail) != 0)
+      if (SYMBOLP (tail))
        while (1)
          {
            (*fn) (tail, arg);
@@ -2502,6 +2508,16 @@ init_lread ()
                   Lisp dirs instead.  */
                Vload_path = nconc2 (Vload_path, dump_path);
 
+             /* Add leim under the installation dir, if it exists.  */
+             tem = Fexpand_file_name (build_string ("leim"),
+                                      Vinstallation_directory);
+             tem1 = Ffile_exists_p (tem);
+             if (!NILP (tem1))
+               {
+                 if (NILP (Fmember (tem, Vload_path)))
+                   Vload_path = nconc2 (Vload_path, Fcons (tem, Qnil));
+               }
+
              /* Add site-list under the installation dir, if it exists.  */
              tem = Fexpand_file_name (build_string ("site-lisp"),
                                       Vinstallation_directory);
@@ -2511,15 +2527,58 @@ init_lread ()
                  if (NILP (Fmember (tem, Vload_path)))
                    Vload_path = nconc2 (Vload_path, Fcons (tem, Qnil));
                }
+
+             /* If Emacs was not built in the source directory,
+                and it is run from where it was built, add to load-path
+                the lisp, leim and site-lisp dirs under that directory.  */
+
+             if (NILP (Fequal (Vinstallation_directory, Vsource_directory)))
+               {
+                 Lisp_Object tem2;
+
+                 tem = Fexpand_file_name (build_string ("src/Makefile"),
+                                          Vinstallation_directory);
+                 tem1 = Ffile_exists_p (tem);
+
+                 /* Don't be fooled if they moved the entire source tree
+                    AFTER dumping Emacs.  If the build directory is indeed
+                    different from the source dir, src/Makefile.in and
+                    src/Makefile will not be found together.  */
+                 tem = Fexpand_file_name (build_string ("src/Makefile.in"),
+                                          Vinstallation_directory);
+                 tem2 = Ffile_exists_p (tem);
+                 if (!NILP (tem1) && NILP (tem2))
+                   {
+                     tem = Fexpand_file_name (build_string ("lisp"),
+                                              Vsource_directory);
+
+                     if (NILP (Fmember (tem, Vload_path)))
+                       Vload_path = nconc2 (Vload_path, Fcons (tem, Qnil));
+
+                     tem = Fexpand_file_name (build_string ("leim"),
+                                              Vsource_directory);
+
+                     if (NILP (Fmember (tem, Vload_path)))
+                       Vload_path = nconc2 (Vload_path, Fcons (tem, Qnil));
+
+                     tem = Fexpand_file_name (build_string ("site-lisp"),
+                                              Vsource_directory);
+
+                     if (NILP (Fmember (tem, Vload_path)))
+                       Vload_path = nconc2 (Vload_path, Fcons (tem, Qnil));
+                   }
+               }
            }
        }
     }
   else
     {
-      /* ../lisp refers to the build directory.
-        NORMAL refers to the lisp dir in the source directory.  */
-      Vload_path = Fcons (build_string ("../lisp"),
-                         decode_env_path (0, normal));
+      /* NORMAL refers to the lisp dir in the source directory.  */
+      /* We used to add ../lisp at the front here, but
+        that caused trouble because it was copied from dump_path
+        into Vload_path, aboe, when Vinstallation_directory was non-nil.
+        It should be unnecessary.  */
+      Vload_path = decode_env_path (0, normal);
       dump_path = Vload_path;
     }
 #endif
@@ -2678,6 +2737,10 @@ You cannot count on them to still be there!");
     = Fexpand_file_name (build_string ("../"),
                         Fcar (decode_env_path (0, PATH_DUMPLOADSEARCH)));
 
+  DEFVAR_LISP ("preloaded-file-list", &Vpreloaded_file_list,
+     "List of files that were preloaded (when dumping Emacs).");
+  Vpreloaded_file_list = Qnil;
+
   /* Vsource_directory was initialized in init_lread.  */
 
   load_descriptor_list = Qnil;