]> code.delx.au - gnu-emacs/blobdiff - src/lread.c
Fixed a bug in w32-long-file-name.
[gnu-emacs] / src / lread.c
index eaf1f818c43998d2e811808c6224ee9bb1a2b9c5..a64f083a5acbde2cb113f2493e8714757283d5b4 100644 (file)
@@ -3537,7 +3537,7 @@ read_vector (Lisp_Object readcharfun, bool bytecodeflag)
   return vector;
 }
 
-/* FLAG means check for ] to terminate rather than ) and .  */
+/* FLAG means check for ']' to terminate rather than ')' and '.'.  */
 
 static Lisp_Object
 read_list (bool flag, Lisp_Object readcharfun)
@@ -4157,17 +4157,15 @@ static Lisp_Object dump_path;
    are not yet installed, we should not use them, even if they exist.)
    If installation-dir/lisp does not exist, just add dump_path at the
    end instead.
-   Add installation-dir/leim (if exists and not already a member) at the front.
    Add installation-dir/site-lisp (if !no_site_lisp, and exists
    and not already a member) at the front.
    If installation-dir != source-dir (ie running an uninstalled,
    out-of-tree build) AND install-dir/src/Makefile exists BUT
    install-dir/src/Makefile.in does NOT exist (this is a sanity
-   check), then repeat the above steps for source-dir/lisp,
-   leim and site-lisp.
-*/
-Lisp_Object
-load_path_default (bool ignore_existing)
+   check), then repeat the above steps for source-dir/lisp, site-lisp.  */
+
+static Lisp_Object
+load_path_default (bool changed)
 {
   Lisp_Object lpath = Qnil;
   const char *normal;
@@ -4193,11 +4191,19 @@ load_path_default (bool ignore_existing)
      the source directory, instead of the path of the installed elisp
      libraries.  However, if it appears that Vload_path has already been
      changed from the default that was saved before dumping, don't
-     change it further.  Changes can only be due to EMACSLOADPATH, or
-     site-lisp files that were processed during dumping.  */
+     change it further.  Changes can only be due to site-lisp
+     files that were processed during dumping.  */
+  /* FIXME?  AFAICS, it does not make sense to change load-path in a
+     dumped site-lisp file, so maybe we should just drop this check.
+     E.g., if you add an element to load-path, you are going to be
+     adding it to PATH_DUMPLOADSEARCH, which refers to the source directory.
+     This will make no sense (and may not still exist) in an installed Emacs.
+     And the only change it is sensible to make to load-path is to add
+     something to the front, which you should do with configure's
+     --enable-locallisppath option if you really want to have it dumped.  */
   if (initialized)
     {
-      if (!ignore_existing && NILP (Fequal (dump_path, Vload_path)))
+      if (changed || NILP (Fequal (dump_path, Vload_path)))
         {
           /* Do not make any changes.  */
           return Vload_path;
@@ -4225,9 +4231,9 @@ load_path_default (bool ignore_existing)
                   if (NILP (Fmember (tem, lpath)))
                     {
                       /* We are running uninstalled.  The default load-path
-                         points to the eventual installed lisp, leim
-                         directories.  We should not use those now, even
-                         if they exist, so start over from a clean slate.  */
+                         points to the eventual installed lisp directories.
+                         We should not use those now, even if they exist,
+                         so start over from a clean slate.  */
                       lpath = list1 (tem);
                     }
                 }
@@ -4236,16 +4242,6 @@ load_path_default (bool ignore_existing)
                    Lisp dirs instead.  */
                 lpath = nconc2 (lpath, dump_path);
 
-              /* Add leim under the installation dir, if it is accessible. */
-              tem = Fexpand_file_name (build_string ("leim"),
-                                       Vinstallation_directory);
-              tem1 = Ffile_accessible_directory_p (tem);
-              if (!NILP (tem1))
-                {
-                  if (NILP (Fmember (tem, lpath)))
-                    lpath = Fcons (tem, lpath);
-                }
-
               /* Add site-lisp under the installation dir, if it exists.  */
               if (!no_site_lisp)
                 {
@@ -4261,7 +4257,7 @@ load_path_default (bool ignore_existing)
 
               /* 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.  */
+                 the lisp and site-lisp dirs under that directory.  */
 
               if (NILP (Fequal (Vinstallation_directory, Vsource_directory)))
                 {
@@ -4286,12 +4282,6 @@ load_path_default (bool ignore_existing)
                       if (NILP (Fmember (tem, lpath)))
                         lpath = Fcons (tem, lpath);
 
-                      tem = Fexpand_file_name (build_string ("leim"),
-                                               Vsource_directory);
-
-                      if (NILP (Fmember (tem, lpath)))
-                        lpath = Fcons (tem, lpath);
-
                       if (!no_site_lisp)
                         {
                           tem = Fexpand_file_name (build_string ("site-lisp"),
@@ -4332,19 +4322,27 @@ init_lread (void)
 {
   /* First, set Vload_path.  */
 
+  /* NB: Do not change Vload_path before calling load_path_default,
+     since it may check it against dump_path.
+     (This behavior could be changed.)  */
+
   /* We explicitly ignore EMACSLOADPATH when dumping.  */
   if (NILP (Vpurify_flag) && egetenv ("EMACSLOADPATH"))
     {
-      Vload_path = decode_env_path ("EMACSLOADPATH", 0, 1);
+      Lisp_Object elpath = decode_env_path ("EMACSLOADPATH", 0, 1);
 
       /* Check (non-nil) user-supplied elements.  */
-      load_path_check (Vload_path);
+      load_path_check (elpath);
 
-      /* Replace any nil elements from the environment with the default.  */
-      if (!NILP (Fmemq (Qnil, Vload_path)))
+      /* If no nils in the environment variable, use as-is.
+         Otherwise, replace any nils with the default.  */
+      if (NILP (Fmemq (Qnil, elpath)))
+        {
+          Vload_path = elpath;
+        }
+      else
         {
-          Lisp_Object lpath = Vload_path;
-          Lisp_Object elem, default_lpath = load_path_default (1);
+          Lisp_Object elem, default_lpath = load_path_default (0);
 
           /* Check defaults, before adding site-lisp.  */
           load_path_check (default_lpath);
@@ -4361,11 +4359,11 @@ init_lread (void)
           Vload_path = Qnil;
 
           /* Replace nils from EMACSLOADPATH by default.  */
-          while (CONSP (lpath))
+          while (CONSP (elpath))
             {
               Lisp_Object arg[2];
-              elem = XCAR (lpath);
-              lpath = XCDR (lpath);
+              elem = XCAR (elpath);
+              elpath = XCDR (elpath);
               arg[0] = Vload_path;
               arg[1] = NILP (elem) ? default_lpath : Fcons (elem, Qnil);
               Vload_path = Fappend (2, arg);
@@ -4374,7 +4372,13 @@ init_lread (void)
     }
   else                          /* Vpurify_flag || !EMACSLOADPATH */
     {
-      Vload_path = load_path_default (0);
+#ifdef CANNOT_DUMP
+      bool changed = 0;
+#else
+      bool changed = initialized && NILP (Fequal (dump_path, Vload_path));
+#endif
+
+      Vload_path = load_path_default (changed);
 
       /* Check before adding site-lisp directories.
          The install should have created them, but they are not
@@ -4383,11 +4387,9 @@ init_lread (void)
       load_path_check (Vload_path);
 
       /* Add the site-lisp directories at the front, unless the
-         load-path has somehow already been changed (this can only be
-         from a site-load file during dumping?) from the dumped value.
-         FIXME?  Should we ignore any dump_path changes?  */
-      if (initialized && !no_site_lisp &&
-          ! NILP (Fequal (dump_path, Vload_path)))
+         load-path has already been changed.
+         FIXME?  Should we ignore changed here?  */
+      if (initialized && !no_site_lisp && !changed)
         {
           Lisp_Object sitelisp;
           sitelisp = decode_env_path (0, PATH_SITELOADSEARCH, 0);