Unconditionally reset load-path after dumping
* src/lread.c: (dump_path): Remove. (load-path-default): Remove `changed' argument. Do not set dump_path permanently. Simplify. (init_lread): Simplify. (syms_of_lread): Remove dump_path. * lisp/loadup.el (load-path): Warn if site-load or site-init changes it. No more need to reset it when bootstrapping. * doc/lispref/internals.texi (Building Emacs): * doc/lispref/loading.texi (Library Search): Mention that site-load, site-init cannot change load-path. * INSTALL: No longer mention load-path and site-init/site-load. * etc/NEWS: Mention this. Fixes: debbugs:16107
This commit is contained in:
parent
978a5fdaa3
commit
06a4f1102f
10 changed files with 143 additions and 156 deletions
|
@ -1,3 +1,7 @@
|
|||
2013-12-13 Glenn Morris <rgm@gnu.org>
|
||||
|
||||
* INSTALL: No longer mention load-path and site-init/site-load.
|
||||
|
||||
2013-12-12 Glenn Morris <rgm@gnu.org>
|
||||
|
||||
* Makefile.in (install-info): Handle missing info/dir.
|
||||
|
|
4
INSTALL
4
INSTALL
|
@ -468,10 +468,6 @@ variable gets by default! Make sure you know what kind of value the
|
|||
variable should have. If you don't pay attention to what you are
|
||||
doing, you'll make a mistake.
|
||||
|
||||
If you set load-path to a different value in site-init.el or
|
||||
site-load.el, Emacs will use *precisely* that value when it starts up
|
||||
again. If you do this, you are on your own!
|
||||
|
||||
The `site-*.el' files are nonexistent in the distribution. You do not
|
||||
need to create them if you have nothing to put in them.
|
||||
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
2013-12-13 Glenn Morris <rgm@gnu.org>
|
||||
|
||||
* internals.texi (Building Emacs):
|
||||
* loading.texi (Library Search): Mention that site-load,
|
||||
site-init cannot change load-path.
|
||||
|
||||
2013-12-12 Glenn Morris <rgm@gnu.org>
|
||||
|
||||
* elisp.texi: Tweak dircategory.
|
||||
|
|
|
@ -116,6 +116,11 @@ time.)
|
|||
expect in an ordinary unmodified Emacs. If you feel you must override
|
||||
normal features for your site, do it with @file{default.el}, so that
|
||||
users can override your changes if they wish. @xref{Startup Summary}.
|
||||
Note that if either @file{site-load.el} or @file{site-init.el} changes
|
||||
@code{load-path}, the changes will be lost after dumping.
|
||||
@xref{Library Search}. To make a permanent change to
|
||||
@code{load-path}, use the @option{--enable-locallisppath} option
|
||||
of @command{configure}.
|
||||
|
||||
In a package that can be preloaded, it is sometimes necessary (or
|
||||
useful) to delay certain evaluations until Emacs subsequently starts
|
||||
|
|
|
@ -361,12 +361,10 @@ add one or more directories to @code{load-path}. For example:
|
|||
(push "~/.emacs.d/lisp" load-path)
|
||||
@end example
|
||||
|
||||
Dumping Emacs uses a special value of @code{load-path}. If the
|
||||
value of @code{load-path} at the end of dumping is unchanged (that is,
|
||||
still the same special value), the dumped Emacs switches to the
|
||||
ordinary @code{load-path} value when it starts up, as described above.
|
||||
But if @code{load-path} has any other value at the end of dumping,
|
||||
that value is used for execution of the dumped Emacs also.
|
||||
Dumping Emacs uses a special value of @code{load-path}. If you use
|
||||
a @file{site-load.el} or @file{site-init.el} file to customize the
|
||||
dumped Emacs (@pxref{Building Emacs}), any changes to @code{load-path}
|
||||
that these files make will be lost after dumping.
|
||||
|
||||
@deffn Command locate-library library &optional nosuffix path interactive-call
|
||||
This command finds the precise file name for library @var{library}. It
|
||||
|
|
6
etc/NEWS
6
etc/NEWS
|
@ -77,6 +77,12 @@ was replaced by ".", so use an explicit "." now if that is what you want.)
|
|||
will instead append, if the argument begins with `:' (or `;' on MS Windows;
|
||||
i.e., `path-separator').
|
||||
|
||||
+++
|
||||
** If you use either site-load.el or site-init.el to customize the dumped
|
||||
Emacs executable, any changes to `load-path' that these files make
|
||||
will no longer be present after dumping. To affect a permanent change
|
||||
to `load-path', use the `--enable-locallisppath' option of `configure'.
|
||||
|
||||
|
||||
* Changes in Emacs 24.4
|
||||
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2013-12-13 Glenn Morris <rgm@gnu.org>
|
||||
|
||||
* loadup.el (load-path): Warn if site-load or site-init changes it.
|
||||
No more need to reset it when bootstrapping.
|
||||
|
||||
2013-12-13 Teodor Zlatanov <tzz@lifelogs.com>
|
||||
|
||||
* progmodes/cfengine.el (cfengine-cf-promises): Add more default
|
||||
|
|
|
@ -46,9 +46,6 @@
|
|||
;; Add subdirectories to the load-path for files that might get
|
||||
;; autoloaded when bootstrapping.
|
||||
;; This is because PATH_DUMPLOADSEARCH is just "../lisp".
|
||||
;; Note that we reset load-path below just before dumping,
|
||||
;; since lread.c:init_lread checks for changes to load-path
|
||||
;; in deciding whether to modify it.
|
||||
(if (or (equal (nth 3 command-line-args) "bootstrap")
|
||||
(equal (nth 4 command-line-args) "bootstrap")
|
||||
;; FIXME this is irritatingly fragile.
|
||||
|
@ -293,8 +290,15 @@
|
|||
;; you may load them with a "site-load.el" file.
|
||||
;; But you must also cause them to be scanned when the DOC file
|
||||
;; is generated.
|
||||
;; For other systems, you must edit ../src/Makefile.in.
|
||||
(load "site-load" t)
|
||||
(let ((lp load-path))
|
||||
(load "site-load" t)
|
||||
;; We reset load-path after dumping.
|
||||
;; For a permanent change in load-path, use configure's
|
||||
;; --enable-locallisppath option.
|
||||
;; See http://debbugs.gnu.org/16107 for more details.
|
||||
(or (equal lp load-path)
|
||||
(message "Warning: Change in load-path due to site-load will be \
|
||||
lost after dumping")))
|
||||
|
||||
;; Make sure default-directory is unibyte when dumping. This is
|
||||
;; because we cannot decode and encode it correctly (since the locale
|
||||
|
@ -342,8 +346,13 @@
|
|||
|
||||
;; Note: You can cause additional libraries to be preloaded
|
||||
;; by writing a site-init.el that loads them.
|
||||
;; See also "site-load" above.
|
||||
(load "site-init" t)
|
||||
;; See also "site-load" above
|
||||
(let ((lp load-path))
|
||||
(load "site-init" t)
|
||||
(or (equal lp load-path)
|
||||
(message "Warning: Change in load-path due to site-init will be \
|
||||
lost after dumping")))
|
||||
|
||||
(setq current-load-list nil)
|
||||
|
||||
;; We keep the load-history data in PURE space.
|
||||
|
@ -353,11 +362,6 @@
|
|||
|
||||
(set-buffer-modified-p nil)
|
||||
|
||||
;; reset the load-path. See lread.c:init_lread why.
|
||||
(if (or (equal (nth 3 command-line-args) "bootstrap")
|
||||
(equal (nth 4 command-line-args) "bootstrap"))
|
||||
(setcdr load-path nil))
|
||||
|
||||
(remove-hook 'after-load-functions (lambda (f) (garbage-collect)))
|
||||
|
||||
(setq inhibit-load-charset-map nil)
|
||||
|
|
|
@ -1,3 +1,12 @@
|
|||
2013-12-13 Glenn Morris <rgm@gnu.org>
|
||||
|
||||
* lread.c: Unconditionally reset load-path after dumping. (Bug#16107)
|
||||
(dump_path): Remove.
|
||||
(load-path-default): Remove `changed' argument.
|
||||
Do not set dump_path permanently. Simplify.
|
||||
(init_lread): Simplify.
|
||||
(syms_of_lread): Remove dump_path.
|
||||
|
||||
2013-12-13 Dmitry Antipov <dmantipov@yandex.ru>
|
||||
|
||||
* alloc.c, font.c, font.h, ftfont.c, ftxfont.c, macfont.m,
|
||||
|
|
222
src/lread.c
222
src/lread.c
|
@ -4128,10 +4128,6 @@ load_path_check (Lisp_Object lpath)
|
|||
}
|
||||
}
|
||||
|
||||
/* 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),
|
||||
|
@ -4145,18 +4141,16 @@ static Lisp_Object dump_path;
|
|||
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,
|
||||
|
@ -4165,7 +4159,7 @@ static Lisp_Object dump_path;
|
|||
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;
|
||||
|
@ -4186,131 +4180,108 @@ load_path_default (bool changed)
|
|||
|
||||
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))
|
||||
{
|
||||
Lisp_Object tem, tem1;
|
||||
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"),
|
||||
/* 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 dump_path =
|
||||
decode_env_path (0, PATH_DUMPLOADSEARCH, 0);
|
||||
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)))
|
||||
{
|
||||
/* 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)
|
||||
/* 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);
|
||||
|
||||
/* 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 ("site-lisp"),
|
||||
Vinstallation_directory);
|
||||
tem1 = Ffile_accessible_directory_p (tem);
|
||||
if (!NILP (tem1))
|
||||
tem = Fexpand_file_name (build_string ("lisp"),
|
||||
Vsource_directory);
|
||||
|
||||
if (NILP (Fmember (tem, lpath)))
|
||||
lpath = Fcons (tem, lpath);
|
||||
|
||||
if (!no_site_lisp)
|
||||
{
|
||||
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 (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"),
|
||||
tem = Fexpand_file_name (build_string ("site-lisp"),
|
||||
Vsource_directory);
|
||||
|
||||
if (NILP (Fmember (tem, lpath)))
|
||||
lpath = Fcons (tem, lpath);
|
||||
|
||||
if (!no_site_lisp)
|
||||
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 */
|
||||
}
|
||||
} /* Vinstallation_directory != Vsource_directory */
|
||||
|
||||
} /* if Vinstallation_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 */
|
||||
|
||||
|
@ -4322,27 +4293,20 @@ 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"))
|
||||
{
|
||||
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)))
|
||||
if (! NILP (Fmemq (Qnil, Vload_path)))
|
||||
{
|
||||
Vload_path = elpath;
|
||||
}
|
||||
else
|
||||
{
|
||||
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);
|
||||
|
@ -4372,13 +4336,7 @@ init_lread (void)
|
|||
}
|
||||
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
|
||||
|
@ -4386,10 +4344,8 @@ init_lread (void)
|
|||
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);
|
||||
|
@ -4694,8 +4650,6 @@ variables, this must be set in the first line of a file. */);
|
|||
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);
|
||||
|
|
Loading…
Add table
Reference in a new issue