}
}
-/* Record the value of load-path used at the start of dumping
- so we can see if the site changed it later during dumping. */
-static Lisp_Object dump_path;
-
/* Return the default load-path, to be used if EMACSLOADPATH is unset.
This does not include the standard site-lisp directories
under the installation prefix (i.e., PATH_SITELOADSEARCH),
If purify-flag (ie dumping) just use PATH_DUMPLOADSEARCH.
Otherwise use PATH_LOADSEARCH.
- If !initialized, then just set dump_path and return PATH_DUMPLOADSEARCH.
- If initialized, then if Vload_path != dump_path, return just Vload_path.
- (Presumably the load-path has already been changed by something.
- This can only be from a site-load file during dumping.)
+ If !initialized, then just return PATH_DUMPLOADSEARCH.
+ If initialized:
If Vinstallation_directory is not nil (ie, running uninstalled):
If installation-dir/lisp exists and not already a member,
we must be running uninstalled. Reset the load-path
to just installation-dir/lisp. (The default PATH_LOADSEARCH
refers to the eventual installation directories. Since we
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.
+ If installation-dir/lisp does not exist, just add
+ PATH_DUMPLOADSEARCH at the end instead.
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,
check), then repeat the above steps for source-dir/lisp, site-lisp. */
static Lisp_Object
-load_path_default (bool changed)
+load_path_default ()
{
Lisp_Object lpath = Qnil;
const char *normal;
normal = NILP (Vpurify_flag) ? PATH_LOADSEARCH : PATH_DUMPLOADSEARCH;
- /* In a dumped Emacs, we normally reset the value of Vload_path using
- PATH_LOADSEARCH, since the value that was dumped uses lisp/ in
- 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 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 (changed || NILP (Fequal (dump_path, Vload_path)))
- {
- /* Do not make any changes. */
- return Vload_path;
- }
- else
- {
#ifdef HAVE_NS
- const char *loadpath = ns_load_path ();
- lpath = decode_env_path (0, loadpath ? loadpath : normal, 0);
+ const char *loadpath = ns_load_path ();
+ lpath = decode_env_path (0, loadpath ? loadpath : normal, 0);
#else
- lpath = decode_env_path (0, normal, 0);
+ lpath = decode_env_path (0, normal, 0);
#endif
- if (!NILP (Vinstallation_directory))
+ if (!NILP (Vinstallation_directory))
+ {
+ Lisp_Object tem, tem1;
+
+ /* Add to the path the lisp subdir of the installation
+ dir, if it is accessible. Note: in out-of-tree builds,
+ this directory is empty save for Makefile. */
+ tem = Fexpand_file_name (build_string ("lisp"),
+ Vinstallation_directory);
+ tem1 = Ffile_accessible_directory_p (tem);
+ if (!NILP (tem1))
+ {
+ if (NILP (Fmember (tem, lpath)))
+ {
+ /* We are running uninstalled. The default load-path
+ 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);
+ }
+ }
+ else
+ /* That dir doesn't exist, so add the build-time
+ Lisp dirs instead. */
{
- Lisp_Object tem, tem1;
+ Lisp_Object dump_path =
+ decode_env_path (0, PATH_DUMPLOADSEARCH, 0);
+ lpath = nconc2 (lpath, dump_path);
+ }
- /* Add to the path the lisp subdir of the installation
- dir, if it is accessible. Note: in out-of-tree builds,
- this directory is empty save for Makefile. */
- tem = Fexpand_file_name (build_string ("lisp"),
+ /* Add site-lisp under the installation dir, if it exists. */
+ if (!no_site_lisp)
+ {
+ tem = Fexpand_file_name (build_string ("site-lisp"),
Vinstallation_directory);
tem1 = Ffile_accessible_directory_p (tem);
if (!NILP (tem1))
{
if (NILP (Fmember (tem, lpath)))
- {
- /* We are running uninstalled. The default load-path
- 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);
- }
+ lpath = Fcons (tem, lpath);
}
- else
- /* That dir doesn't exist, so add the build-time
- Lisp dirs instead. */
- lpath = nconc2 (lpath, dump_path);
+ }
- /* Add site-lisp under the installation dir, if it exists. */
- if (!no_site_lisp)
- {
- tem = Fexpand_file_name (build_string ("site-lisp"),
- Vinstallation_directory);
- tem1 = Ffile_accessible_directory_p (tem);
- if (!NILP (tem1))
- {
- if (NILP (Fmember (tem, lpath)))
- lpath = Fcons (tem, lpath);
- }
- }
+ /* If Emacs was not built in the source directory,
+ and it is run from where it was built, add to load-path
+ the lisp and site-lisp dirs under that directory. */
- /* If Emacs was not built in the source directory,
- and it is run from where it was built, add to load-path
- the lisp 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);
- if (NILP (Fequal (Vinstallation_directory, Vsource_directory)))
+ /* 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))
{
- 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);
+ tem = Fexpand_file_name (build_string ("lisp"),
+ Vsource_directory);
- if (NILP (Fmember (tem, lpath)))
- lpath = Fcons (tem, lpath);
+ if (NILP (Fmember (tem, lpath)))
+ lpath = Fcons (tem, lpath);
- if (!no_site_lisp)
+ if (!no_site_lisp)
+ {
+ tem = Fexpand_file_name (build_string ("site-lisp"),
+ Vsource_directory);
+ tem1 = Ffile_accessible_directory_p (tem);
+ if (!NILP (tem1))
{
- tem = Fexpand_file_name (build_string ("site-lisp"),
- Vsource_directory);
- tem1 = Ffile_accessible_directory_p (tem);
- if (!NILP (tem1))
- {
- if (NILP (Fmember (tem, lpath)))
- lpath = Fcons (tem, lpath);
- }
+ if (NILP (Fmember (tem, lpath)))
+ lpath = Fcons (tem, lpath);
}
}
- } /* Vinstallation_directory != Vsource_directory */
-
- } /* if Vinstallation_directory */
+ }
+ } /* Vinstallation_directory != Vsource_directory */
- } /* if dump_path == Vload_path */
+ } /* if Vinstallation_directory */
}
else /* !initialized */
{
/* NORMAL refers to PATH_DUMPLOADSEARCH, ie the lisp dir in the
source directory. We used to add ../lisp (ie the lisp dir in
- the build directory) at the front here, but that caused trouble
- because it was copied from dump_path into Vload_path, above,
- when Vinstallation_directory was non-nil. It should not be
- necessary, since in out of tree builds lisp/ is empty, save
+ the build directory) at the front here, but that should not
+ be necessary, since in out of tree builds lisp/ is empty, save
for Makefile. */
lpath = decode_env_path (0, normal, 0);
- dump_path = lpath;
}
#endif /* !CANNOT_DUMP */
{
/* 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"))
{
- Lisp_Object elpath = decode_env_path ("EMACSLOADPATH", 0, 1);
+ Vload_path = decode_env_path ("EMACSLOADPATH", 0, 1);
/* Check (non-nil) user-supplied elements. */
- load_path_check (elpath);
+ load_path_check (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
+ if (! NILP (Fmemq (Qnil, Vload_path)))
{
- Lisp_Object elem, default_lpath = load_path_default (0);
+ Lisp_Object elem, elpath = Vload_path;
+ Lisp_Object default_lpath = load_path_default ();
/* Check defaults, before adding site-lisp. */
load_path_check (default_lpath);
}
else /* Vpurify_flag || !EMACSLOADPATH */
{
-#ifdef CANNOT_DUMP
- bool changed = 0;
-#else
- bool changed = initialized && NILP (Fequal (dump_path, Vload_path));
-#endif
-
- Vload_path = load_path_default (changed);
+ Vload_path = load_path_default ();
/* Check before adding site-lisp directories.
The install should have created them, but they are not
Or we might be running before installation. */
load_path_check (Vload_path);
- /* Add the site-lisp directories at the front, unless the
- load-path has already been changed.
- FIXME? Should we ignore changed here? */
- if (initialized && !no_site_lisp && !changed)
+ /* Add the site-lisp directories at the front. */
+ if (initialized && !no_site_lisp)
{
Lisp_Object sitelisp;
sitelisp = decode_env_path (0, PATH_SITELOADSEARCH, 0);
DEFSYM (Qdir_ok, "dir-ok");
DEFSYM (Qdo_after_load_evaluation, "do-after-load-evaluation");
- staticpro (&dump_path);
-
staticpro (&read_objects);
read_objects = Qnil;
staticpro (&seen_list);