[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] trunk r115192: Empty elements in EMACSLOADPATH now stand f
From: |
Glenn Morris |
Subject: |
[Emacs-diffs] trunk r115192: Empty elements in EMACSLOADPATH now stand for the default |
Date: |
Sat, 23 Nov 2013 01:55:40 +0000 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 115192
revision-id: address@hidden
parent: address@hidden
fixes bug: http://debbugs.gnu.org/12100
committer: Glenn Morris <address@hidden>
branch nick: trunk
timestamp: Fri 2013-11-22 17:55:16 -0800
message:
Empty elements in EMACSLOADPATH now stand for the default
* src/lread.c (load_path_check): Take path to check as argument.
(load_path_default): New, split from init_lread.
(init_lread): Move calc of default load-path to load_path_default.
Empty elements in EMACSLOADPATH now stand for the default.
(load-path): Doc fix.
* src/emacs.c (decode_env_path): Add option to treat empty elements
as nil rather than ".".
* src/callproc.c (init_callproc_1, init_callproc):
* src/image.c (Vx_bitmap_file_path):
* src/lisp.h (decode_env_path):
* lread.c (Vsource_directory):
Update for new argument spec of decode_env_path.
* leim/Makefile.in (RUN_EMACS): Empty EMACSLOADPATH rather than unsetting.
* lisp/Makefile.in (emacs): Empty EMACSLOADPATH rather than unsetting.
* test/automated/Makefile.in (emacs):
Empty EMACSLOADPATH rather than unsetting.
* doc/emacs/cmdargs.texi (General Variables):
Empty elements in EMACSLOADPATH now mean the default load-path.
* doc/lispref/loading.texi (Library Search):
Empty elements in EMACSLOADPATH now mean the default load-path.
* etc/NEWS: Mention this.
modified:
doc/emacs/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-6227
doc/emacs/cmdargs.texi
cmdargs.texi-20091113204419-o5vbwnq5f7feedwu-6238
doc/lispref/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-6155
doc/lispref/loading.texi
loading.texi-20091113204419-o5vbwnq5f7feedwu-6193
etc/NEWS news-20100311060928-aoit31wvzf25yr1z-1
leim/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-1629
leim/Makefile.in
makefile.in-20091113204419-o5vbwnq5f7feedwu-1200
lisp/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-1432
lisp/Makefile.in
makefile.in-20091113204419-o5vbwnq5f7feedwu-1831
src/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-1438
src/callproc.c callproc.c-20091113204419-o5vbwnq5f7feedwu-248
src/emacs.c emacs.c-20091113204419-o5vbwnq5f7feedwu-241
src/image.c image.c-20091113204419-o5vbwnq5f7feedwu-2969
src/lisp.h lisp.h-20091113204419-o5vbwnq5f7feedwu-253
src/lread.c lread.c-20091113204419-o5vbwnq5f7feedwu-266
test/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-8588
test/automated/Makefile.in makefile.in-20110112160650-056hnl9qhpjvjicy-6
=== modified file 'doc/emacs/ChangeLog'
--- a/doc/emacs/ChangeLog 2013-11-21 00:21:50 +0000
+++ b/doc/emacs/ChangeLog 2013-11-23 01:55:16 +0000
@@ -1,3 +1,8 @@
+2013-11-23 Glenn Morris <address@hidden>
+
+ * cmdargs.texi (General Variables):
+ Empty elements in EMACSLOADPATH now mean the default load-path.
+
2013-11-21 Glenn Morris <address@hidden>
* cmdargs.texi (Action Arguments): Use path-separator with -L.
=== modified file 'doc/emacs/cmdargs.texi'
--- a/doc/emacs/cmdargs.texi 2013-11-21 00:21:50 +0000
+++ b/doc/emacs/cmdargs.texi 2013-11-23 01:55:16 +0000
@@ -455,13 +455,16 @@
Directory for the documentation string file, which is used to
initialize the Lisp variable @code{doc-directory}.
@item EMACSLOADPATH
-A colon-separated list of address@hidden Here and below,
+A colon-separated list of address@hidden and below,
whenever we say ``colon-separated list of directories'', it pertains
to Unix and GNU/Linux systems. On MS-DOS and MS-Windows, the
directories are separated by semi-colons instead, since DOS/Windows
-file names might include a colon after a drive letter.} to search for
-Emacs Lisp files. If set, it overrides the usual initial value of the
address@hidden variable (@pxref{Lisp Libraries}).
+file names might include a colon after a drive letter.} to search for
+Emacs Lisp files. If set, it modifies the usual initial value of the
address@hidden variable (@pxref{Lisp Libraries}). An empty element
+stands for the default value of @code{load-path}; e.g., using
address@hidden"/tmp:"} adds @file{/tmp} to the front of
+the default @code{load-path}.
@item EMACSPATH
A colon-separated list of directories to search for executable files.
If set, Emacs uses this in addition to @env{PATH} (see below) when
=== modified file 'doc/lispref/ChangeLog'
--- a/doc/lispref/ChangeLog 2013-11-22 02:59:02 +0000
+++ b/doc/lispref/ChangeLog 2013-11-23 01:55:16 +0000
@@ -1,3 +1,8 @@
+2013-11-23 Glenn Morris <address@hidden>
+
+ * loading.texi (Library Search):
+ Empty elements in EMACSLOADPATH now mean the default load-path.
+
2013-11-22 Glenn Morris <address@hidden>
* loading.texi (Library Search): Minor clarification.
=== modified file 'doc/lispref/loading.texi'
--- a/doc/lispref/loading.texi 2013-11-22 02:59:02 +0000
+++ b/doc/lispref/loading.texi 2013-11-23 01:55:16 +0000
@@ -310,25 +310,34 @@
@file{site-lisp} directories.)
@cindex @env{EMACSLOADPATH} environment variable
-If the environment variable @env{EMACSLOADPATH} is set, it overrides
-the above initialization procedure. That is, Emacs initializes
address@hidden based solely on the value of the environment
-variable. You must therefore include the directory containing the
-standard Lisp files, else Emacs will not function. In most
-situations, it is better to use the @option{-L} command-line option
-(see below) to add elements to @code{load-path}.
+If the environment variable @env{EMACSLOADPATH} is set, it modifies
+the above initialization procedure. Emacs initializes
address@hidden based on the value of the environment variable.
The syntax of @env{EMACSLOADPATH} is the same as used for @code{PATH};
directory names are separated by @samp{:} (or @samp{;}, on some
-operating systems), and @samp{.} stands for the current default
-directory. Here is an example of how to set @env{EMACSLOADPATH}
-variable (from a @command{sh}-style shell):
+operating systems).
address@hidden
address@hidden AFAICS, does not (yet) work right to specify non-absolute
elements.
+and @samp{.} stands for the current default directory.
address@hidden ignore
+Here is an example of how to set @env{EMACSLOADPATH} variable (from a
address@hidden shell):
@example
-export EMACSLOADPATH
-EMACSLOADPATH=/home/foo/.emacs.d/lisp:/usr/local/emacs/24.3/lisp
+export EMACSLOADPATH=/home/foo/.emacs.d/lisp:
@end example
+An empty element in the value of the environment variable, whether
+trailing (as in the above example), leading, or embedded, is replaced
+by the default value of @code{load-path} as determined by the standard
+initialization procedure. If there are no such empty elements, then
address@hidden specifies the entire @code{load-path}. You must
+include either an empty element, or the explicit path to the directory
+containing the standard Lisp files, else Emacs will not function.
+(Another way to modify @code{load-path} is to use the @option{-L}
+command-line option when starting Emacs; see below.)
+
For each directory in @code{load-path}, Emacs then checks to see if
it contains a file @file{subdirs.el}, and if so, loads it. The
@file{subdirs.el} file is created when Emacs is built/installed,
=== modified file 'etc/NEWS'
--- a/etc/NEWS 2013-11-21 00:21:50 +0000
+++ b/etc/NEWS 2013-11-23 01:55:16 +0000
@@ -63,6 +63,16 @@
* Startup Changes in Emacs 24.4
+++
+** When initializing `load-path', an empty element in the EMACSLOADPATH
+environment variable (either leading, e.g., ":/foo"; trailing, e.g.,
+"/foo:"; or embedded, e.g., "/foo::/bar") is replaced with the default
+load-path (the one that would have been used if EMACSLOADPATH was unset).
+This makes it easier to _extend_ the load-path via EMACSLOADPATH
+(previously, EMACSLOADPATH had to specify the complete load-path,
+including the defaults). (In older versions of Emacs, an empty element
+was replaced by ".", so use an explicit "." now if that is what you want.)
+
++++
** The -L option, which normally prepends its argument to load-path,
will instead append, if the argument begins with `:' (or `;' on MS Windows;
i.e., `path-separator').
=== modified file 'leim/ChangeLog'
--- a/leim/ChangeLog 2013-11-04 17:30:33 +0000
+++ b/leim/ChangeLog 2013-11-23 01:55:16 +0000
@@ -1,3 +1,7 @@
+2013-11-23 Glenn Morris <address@hidden>
+
+ * Makefile.in (RUN_EMACS): Empty EMACSLOADPATH rather than unsetting.
+
2013-11-04 Eli Zaretskii <address@hidden>
* Makefile.in (RUN_EMACS): Don't set LC_ALL=C. (Bug#15260)
=== modified file 'leim/Makefile.in'
--- a/leim/Makefile.in 2013-11-04 17:30:33 +0000
+++ b/leim/Makefile.in 2013-11-23 01:55:16 +0000
@@ -32,8 +32,7 @@
# How to run Emacs.
# Prevent any setting of EMACSLOADPATH in user environment causing problems.
-RUN_EMACS = unset EMACSLOADPATH; "${EMACS}" -batch \
- --no-site-file --no-site-lisp
+RUN_EMACS = EMACSLOADPATH= "${EMACS}" -batch --no-site-file --no-site-lisp
MKDIR_P = @MKDIR_P@
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2013-11-22 14:17:48 +0000
+++ b/lisp/ChangeLog 2013-11-23 01:55:16 +0000
@@ -1,3 +1,7 @@
+2013-11-23 Glenn Morris <address@hidden>
+
+ * Makefile.in (emacs): Empty EMACSLOADPATH rather than unsetting.
+
2013-11-22 Leo Liu <address@hidden>
* progmodes/octave.el (inferior-octave-startup): Spit out error
=== modified file 'lisp/Makefile.in'
--- a/lisp/Makefile.in 2013-11-06 17:56:48 +0000
+++ b/lisp/Makefile.in 2013-11-23 01:55:16 +0000
@@ -106,7 +106,7 @@
# The actual Emacs command run in the targets below.
# Prevent any setting of EMACSLOADPATH in user environment causing problems.
-emacs = unset EMACSLOADPATH; "$(EMACS)" $(EMACSOPT)
+emacs = EMACSLOADPATH= "$(EMACS)" $(EMACSOPT)
# Common command to find subdirectories
setwins=for file in `find . -type d -print`; do \
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2013-11-22 16:04:49 +0000
+++ b/src/ChangeLog 2013-11-23 01:55:16 +0000
@@ -1,3 +1,19 @@
+2013-11-23 Glenn Morris <address@hidden>
+
+ Empty elements in EMACSLOADPATH stand for the default. (Bug#12100)
+ * lread.c (load_path_check): Take path to check as argument.
+ (load_path_default): New, split from init_lread.
+ (init_lread): Move calc of default load-path to load_path_default.
+ Empty elements in EMACSLOADPATH now stand for the default.
+ (load-path): Doc fix.
+ * emacs.c (decode_env_path): Add option to treat empty elements
+ as nil rather than ".".
+ * callproc.c (init_callproc_1, init_callproc):
+ * image.c (Vx_bitmap_file_path):
+ * lisp.h (decode_env_path):
+ * lread.c (Vsource_directory):
+ Update for new argument spec of decode_env_path.
+
2013-11-22 Eli Zaretskii <address@hidden>
* bidi.c (bidi_find_paragraph_start): Limit the returned positions
=== modified file 'src/callproc.c'
--- a/src/callproc.c 2013-11-05 22:45:44 +0000
+++ b/src/callproc.c 2013-11-23 01:55:16 +0000
@@ -1,6 +1,6 @@
/* Synchronous subprocess invocation for GNU Emacs.
- Copyright (C) 1985-1988, 1993-1995, 1999-2013
- Free Software Foundation, Inc.
+
+Copyright (C) 1985-1988, 1993-1995, 1999-2013 Free Software Foundation, Inc.
This file is part of GNU Emacs.
@@ -1520,14 +1520,14 @@
#ifdef HAVE_NS
etc_dir ? etc_dir :
#endif
- PATH_DATA);
+ PATH_DATA, 0);
Vdata_directory = Ffile_name_as_directory (Fcar (Vdata_directory));
Vdoc_directory = decode_env_path ("EMACSDOC",
#ifdef HAVE_NS
etc_dir ? etc_dir :
#endif
- PATH_DOC);
+ PATH_DOC, 0);
Vdoc_directory = Ffile_name_as_directory (Fcar (Vdoc_directory));
/* Check the EMACSPATH environment variable, defaulting to the
@@ -1536,10 +1536,10 @@
#ifdef HAVE_NS
path_exec ? path_exec :
#endif
- PATH_EXEC);
+ PATH_EXEC, 0);
Vexec_directory = Ffile_name_as_directory (Fcar (Vexec_path));
/* FIXME? For ns, path_exec should go at the front? */
- Vexec_path = nconc2 (decode_env_path ("PATH", ""), Vexec_path);
+ Vexec_path = nconc2 (decode_env_path ("PATH", "", 0), Vexec_path);
}
/* This is run after init_cmdargs, when Vinstallation_directory is valid. */
@@ -1580,9 +1580,9 @@
#ifdef HAVE_NS
path_exec ? path_exec :
#endif
- PATH_EXEC);
+ PATH_EXEC, 0);
Vexec_path = Fcons (tem, Vexec_path);
- Vexec_path = nconc2 (decode_env_path ("PATH", ""), Vexec_path);
+ Vexec_path = nconc2 (decode_env_path ("PATH", "", 0), Vexec_path);
}
Vexec_directory = Ffile_name_as_directory (tem);
=== modified file 'src/emacs.c'
--- a/src/emacs.c 2013-11-04 17:30:33 +0000
+++ b/src/emacs.c 2013-11-23 01:55:16 +0000
@@ -2167,10 +2167,13 @@
Lisp_Object
-decode_env_path (const char *evarname, const char *defalt)
+decode_env_path (const char *evarname, const char *defalt, bool empty)
{
const char *path, *p;
Lisp_Object lpath, element, tem;
+ /* Default is to use "." for empty path elements.
+ But if argument EMPTY is true, use nil instead. */
+ Lisp_Object empty_element = empty ? Qnil : build_string (".");
#ifdef WINDOWSNT
bool defaulted = 0;
const char *emacs_dir = egetenv ("emacs_dir");
@@ -2209,34 +2212,38 @@
if (!p)
p = path + strlen (path);
element = (p - path ? make_unibyte_string (path, p - path)
- : build_string ("."));
+ : empty_element);
+ if (! NILP (element))
+ {
#ifdef WINDOWSNT
- /* Relative file names in the default path are interpreted as
- being relative to $emacs_dir. */
- if (emacs_dir && defaulted
- && strncmp (path, emacs_dir_env, emacs_dir_len) == 0)
- element = Fexpand_file_name (Fsubstring (element,
- make_number (emacs_dir_len),
- Qnil),
- build_unibyte_string (emacs_dir));
+ /* Relative file names in the default path are interpreted as
+ being relative to $emacs_dir. */
+ if (emacs_dir && defaulted
+ && strncmp (path, emacs_dir_env, emacs_dir_len) == 0)
+ element = Fexpand_file_name (Fsubstring
+ (element,
+ make_number (emacs_dir_len),
+ Qnil),
+ build_unibyte_string (emacs_dir));
#endif
- /* Add /: to the front of the name
- if it would otherwise be treated as magic. */
- tem = Ffind_file_name_handler (element, Qt);
-
- /* However, if the handler says "I'm safe",
- don't bother adding /:. */
- if (SYMBOLP (tem))
- {
- Lisp_Object prop;
- prop = Fget (tem, intern ("safe-magic"));
- if (! NILP (prop))
- tem = Qnil;
- }
-
- if (! NILP (tem))
- element = concat2 (build_string ("/:"), element);
+ /* Add /: to the front of the name
+ if it would otherwise be treated as magic. */
+ tem = Ffind_file_name_handler (element, Qt);
+
+ /* However, if the handler says "I'm safe",
+ don't bother adding /:. */
+ if (SYMBOLP (tem))
+ {
+ Lisp_Object prop;
+ prop = Fget (tem, intern ("safe-magic"));
+ if (! NILP (prop))
+ tem = Qnil;
+ }
+
+ if (! NILP (tem))
+ element = concat2 (build_string ("/:"), element);
+ } /* !NILP (element) */
lpath = Fcons (element, lpath);
if (*p)
=== modified file 'src/image.c'
--- a/src/image.c 2013-11-06 04:11:04 +0000
+++ b/src/image.c 2013-11-23 01:55:16 +0000
@@ -9502,7 +9502,7 @@
DEFVAR_LISP ("x-bitmap-file-path", Vx_bitmap_file_path,
doc: /* List of directories to search for window system bitmap files. */);
- Vx_bitmap_file_path = decode_env_path (0, PATH_BITMAPS);
+ Vx_bitmap_file_path = decode_env_path (0, PATH_BITMAPS, 0);
DEFVAR_LISP ("image-cache-eviction-delay", Vimage_cache_eviction_delay,
doc: /* Maximum time after which images are removed from the cache.
=== modified file 'src/lisp.h'
--- a/src/lisp.h 2013-11-21 06:46:59 +0000
+++ b/src/lisp.h 2013-11-23 01:55:16 +0000
@@ -1,7 +1,6 @@
/* Fundamental definitions for GNU Emacs Lisp interpreter.
-Copyright (C) 1985-1987, 1993-1995, 1997-2013 Free Software Foundation,
-Inc.
+Copyright (C) 1985-1987, 1993-1995, 1997-2013 Free Software Foundation, Inc.
This file is part of GNU Emacs.
@@ -4058,7 +4057,7 @@
#if defined (HAVE_X_WINDOWS) || defined (HAVE_NS)
extern bool display_arg;
#endif
-extern Lisp_Object decode_env_path (const char *, const char *);
+extern Lisp_Object decode_env_path (const char *, const char *, bool);
extern Lisp_Object empty_unibyte_string, empty_multibyte_string;
extern Lisp_Object Qfile_name_handler_alist;
extern _Noreturn void terminate_due_to_signal (int, int);
=== modified file 'src/lread.c'
--- a/src/lread.c 2013-11-14 02:39:28 +0000
+++ b/src/lread.c 2013-11-23 01:55:16 +0000
@@ -1,7 +1,6 @@
/* Lisp parsing and input streams.
-Copyright (C) 1985-1989, 1993-1995, 1997-2013 Free Software Foundation,
-Inc.
+Copyright (C) 1985-1989, 1993-1995, 1997-2013 Free Software Foundation, Inc.
This file is part of GNU Emacs.
@@ -4106,17 +4105,17 @@
SET_SYMBOL_FWD (XSYMBOL (sym), (union Lisp_Fwd *)ko_fwd);
}
-/* Check that the elements of Vload_path exist. */
+/* Check that the elements of lpath exist. */
static void
-load_path_check (void)
+load_path_check (Lisp_Object lpath)
{
Lisp_Object path_tail;
/* The only elements that might not exist are those from
PATH_LOADSEARCH, EMACSLOADPATH. Anything else is only added if
it exists. */
- for (path_tail = Vload_path; !NILP (path_tail); path_tail = XCDR (path_tail))
+ for (path_tail = lpath; !NILP (path_tail); path_tail = XCDR (path_tail))
{
Lisp_Object dirfile;
dirfile = Fcar (path_tail);
@@ -4133,19 +4132,23 @@
so we can see if the site changed it later during dumping. */
static Lisp_Object dump_path;
-/* Compute the default Vload_path, with the following logic:
- If CANNOT_DUMP:
- use EMACSLOADPATH env-var if set; otherwise use PATH_LOADSEARCH,
- prepending PATH_SITELOADSEARCH unless --no-site-lisp.
+/* 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),
+ but it does (unless no_site_lisp is set) include site-lisp
+ directories in the source/build directories if those exist and we
+ are running uninstalled.
+
+ Uses the following logic:
+ If CANNOT_DUMP: Use PATH_LOADSEARCH.
The remainder is what happens when dumping works:
If purify-flag (ie dumping) just use PATH_DUMPLOADSEARCH.
- Otherwise use EMACSLOADPATH if set, else PATH_LOADSEARCH.
+ Otherwise use PATH_LOADSEARCH.
- If !initialized, then just set both Vload_path and dump_path.
- If initialized, then if Vload_path != dump_path, do nothing.
+ 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,
- or because EMACSLOADPATH is set.)
+ This can only be from a site-load file during dumping.)
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
@@ -4162,12 +4165,11 @@
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.
- Finally, add the site-lisp directories at the front (if !no_site_lisp).
*/
-
-void
-init_lread (void)
+Lisp_Object
+load_path_default (bool ignore_existing)
{
+ Lisp_Object lpath = Qnil;
const char *normal;
#ifdef CANNOT_DUMP
@@ -4177,35 +4179,14 @@
normal = PATH_LOADSEARCH;
#ifdef HAVE_NS
- Vload_path = decode_env_path ("EMACSLOADPATH", loadpath ? loadpath : normal);
+ lpath = decode_env_path (0, loadpath ? loadpath : normal, 0);
#else
- Vload_path = decode_env_path ("EMACSLOADPATH", normal);
+ lpath = decode_env_path (0, normal, 0);
#endif
- load_path_check ();
-
- /* FIXME CANNOT_DUMP platforms should get source-dir/lisp etc added
- to their load-path too, AFAICS. I don't think we can tell the
- difference between initialized and !initialized in this case,
- so we'll have to do it unconditionally when Vinstallation_directory
- is non-nil. */
- if (!no_site_lisp && !egetenv ("EMACSLOADPATH"))
- {
- Lisp_Object sitelisp;
- sitelisp = decode_env_path (0, PATH_SITELOADSEARCH);
- if (! NILP (sitelisp)) Vload_path = nconc2 (sitelisp, Vload_path);
- }
#else /* !CANNOT_DUMP */
- if (NILP (Vpurify_flag))
- {
- normal = PATH_LOADSEARCH;
- /* If the EMACSLOADPATH environment variable is set, use its value.
- This doesn't apply if we're dumping. */
- if (egetenv ("EMACSLOADPATH"))
- Vload_path = decode_env_path ("EMACSLOADPATH", normal);
- }
- else
- normal = PATH_DUMPLOADSEARCH;
+
+ 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
@@ -4216,24 +4197,22 @@
site-lisp files that were processed during dumping. */
if (initialized)
{
- if (NILP (Fequal (dump_path, Vload_path)))
+ if (!ignore_existing && NILP (Fequal (dump_path, Vload_path)))
{
- /* Do not make any changes, just check the elements exist. */
- /* Note: --no-site-lisp is ignored.
- I don't know what to do about this. */
- load_path_check ();
+ /* Do not make any changes. */
+ return Vload_path;
}
else
- {
+ {
#ifdef HAVE_NS
- const char *loadpath = ns_load_path ();
- Vload_path = decode_env_path (0, loadpath ? loadpath : normal);
+ const char *loadpath = ns_load_path ();
+ lpath = decode_env_path (0, loadpath ? loadpath : normal, 0);
#else
- Vload_path = decode_env_path (0, normal);
+ 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,
@@ -4243,19 +4222,19 @@
tem1 = Ffile_accessible_directory_p (tem);
if (!NILP (tem1))
{
- if (NILP (Fmember (tem, Vload_path)))
+ 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. */
- Vload_path = list1 (tem);
+ lpath = list1 (tem);
}
}
else
/* That dir doesn't exist, so add the build-time
Lisp dirs instead. */
- Vload_path = nconc2 (Vload_path, dump_path);
+ lpath = nconc2 (lpath, dump_path);
/* Add leim under the installation dir, if it is accessible. */
tem = Fexpand_file_name (build_string ("leim"),
@@ -4263,8 +4242,8 @@
tem1 = Ffile_accessible_directory_p (tem);
if (!NILP (tem1))
{
- if (NILP (Fmember (tem, Vload_path)))
- Vload_path = Fcons (tem, Vload_path);
+ if (NILP (Fmember (tem, lpath)))
+ lpath = Fcons (tem, lpath);
}
/* Add site-lisp under the installation dir, if it exists. */
@@ -4275,8 +4254,8 @@
tem1 = Ffile_accessible_directory_p (tem);
if (!NILP (tem1))
{
- if (NILP (Fmember (tem, Vload_path)))
- Vload_path = Fcons (tem, Vload_path);
+ if (NILP (Fmember (tem, lpath)))
+ lpath = Fcons (tem, lpath);
}
}
@@ -4304,14 +4283,14 @@
tem = Fexpand_file_name (build_string ("lisp"),
Vsource_directory);
- if (NILP (Fmember (tem, Vload_path)))
- Vload_path = Fcons (tem, Vload_path);
+ if (NILP (Fmember (tem, lpath)))
+ lpath = Fcons (tem, lpath);
tem = Fexpand_file_name (build_string ("leim"),
Vsource_directory);
- if (NILP (Fmember (tem, Vload_path)))
- Vload_path = Fcons (tem, Vload_path);
+ if (NILP (Fmember (tem, lpath)))
+ lpath = Fcons (tem, lpath);
if (!no_site_lisp)
{
@@ -4320,47 +4299,101 @@
tem1 = Ffile_accessible_directory_p (tem);
if (!NILP (tem1))
{
- if (NILP (Fmember (tem, Vload_path)))
- Vload_path = Fcons (tem, Vload_path);
+ if (NILP (Fmember (tem, lpath)))
+ lpath = Fcons (tem, lpath);
}
}
}
} /* Vinstallation_directory != Vsource_directory */
- } /* if Vinstallation_directory */
-
- /* Check before adding the site-lisp directories.
- The install should have created them, but they are not
- required, so no need to warn if they are absent.
- Or we might be running before installation. */
- load_path_check ();
-
- /* Add the site-lisp directories at the front. */
- if (!no_site_lisp)
- {
- Lisp_Object sitelisp;
- sitelisp = decode_env_path (0, PATH_SITELOADSEARCH);
- if (! NILP (sitelisp)) Vload_path = nconc2 (sitelisp,
Vload_path);
- }
- } /* if dump_path == Vload_path */
+ } /* if Vinstallation_directory */
+
+ } /* if dump_path == Vload_path */
}
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
+ 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
for Makefile. */
- Vload_path = decode_env_path (0, normal);
- dump_path = Vload_path;
- /* No point calling load_path_check; load-path only contains essential
- elements from the source directory at this point. They cannot
- be missing unless something went extremely (and improbably)
- wrong, in which case the build will fail in obvious ways. */
- }
-#endif /* !CANNOT_DUMP */
+ lpath = decode_env_path (0, normal, 0);
+ dump_path = lpath;
+ }
+#endif /* !CANNOT_DUMP */
+
+ return lpath;
+}
+
+void
+init_lread (void)
+{
+ /* First, set Vload_path. */
+
+ /* We explicitly ignore EMACSLOADPATH when dumping. */
+ if (NILP (Vpurify_flag) && egetenv ("EMACSLOADPATH"))
+ {
+ Vload_path = decode_env_path ("EMACSLOADPATH", 0, 1);
+
+ /* Check (non-nil) user-supplied elements. */
+ load_path_check (Vload_path);
+
+ /* Replace any nil elements from the environment with the default. */
+ if (Fmemq (Qnil, Vload_path))
+ {
+ Lisp_Object lpath = Vload_path;
+ Lisp_Object elem, default_lpath = load_path_default (1);
+
+ /* Check defaults, before adding site-lisp. */
+ load_path_check (default_lpath);
+
+ /* Add the site-lisp directories to the front of the default. */
+ if (!no_site_lisp)
+ {
+ Lisp_Object sitelisp;
+ sitelisp = decode_env_path (0, PATH_SITELOADSEARCH, 0);
+ if (! NILP (sitelisp))
+ default_lpath = nconc2 (sitelisp, default_lpath);
+ }
+
+ Vload_path = Qnil;
+
+ /* Replace nils from EMACSLOADPATH by default. */
+ while (CONSP (lpath))
+ {
+ Lisp_Object arg[2];
+ elem = XCAR (lpath);
+ lpath = XCDR (lpath);
+ arg[0] = Vload_path;
+ arg[1] = NILP (elem) ? default_lpath : Fcons (elem, Qnil);
+ Vload_path = Fappend (2, arg);
+ }
+ } /* Fmemq (Qnil, Vload_path) */
+ }
+ else /* Vpurify_flag || !EMACSLOADPATH */
+ {
+ Vload_path = load_path_default (0);
+
+ /* Check before adding site-lisp directories.
+ The install should have created them, but they are not
+ required, so no need to warn if they are absent.
+ 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 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)))
+ {
+ Lisp_Object sitelisp;
+ sitelisp = decode_env_path (0, PATH_SITELOADSEARCH, 0);
+ if (! NILP (sitelisp)) Vload_path = nconc2 (sitelisp, Vload_path);
+ }
+ } /* !Vpurify_flag && EMACSLOADPATH */
Vvalues = Qnil;
@@ -4467,9 +4500,8 @@
DEFVAR_LISP ("load-path", Vload_path,
doc: /* List of directories to search for files to load.
-Each element is a string (directory name) or nil (try default directory).
-Initialized based on EMACSLOADPATH environment variable, if any,
-otherwise to default specified by file `epaths.h' when Emacs was built. */);
+Each element is a string (directory name) or nil (meaning `default-directory').
+Initialized during startup as described in Info node `(elisp)Library Search'.
*/);
DEFVAR_LISP ("load-suffixes", Vload_suffixes,
doc: /* List of suffixes for (compiled or source) Emacs Lisp
files.
@@ -4585,7 +4617,7 @@
You cannot count on them to still be there! */);
Vsource_directory
= Fexpand_file_name (build_string ("../"),
- Fcar (decode_env_path (0, PATH_DUMPLOADSEARCH)));
+ Fcar (decode_env_path (0, PATH_DUMPLOADSEARCH, 0)));
DEFVAR_LISP ("preloaded-file-list", Vpreloaded_file_list,
doc: /* List of files that were preloaded (when dumping Emacs).
*/);
=== modified file 'test/ChangeLog'
--- a/test/ChangeLog 2013-11-22 11:02:26 +0000
+++ b/test/ChangeLog 2013-11-23 01:55:16 +0000
@@ -1,3 +1,8 @@
+2013-11-23 Glenn Morris <address@hidden>
+
+ * automated/Makefile.in (emacs):
+ Empty EMACSLOADPATH rather than unsetting.
+
2013-11-22 Glenn Morris <address@hidden>
* automated/ruby-mode-tests.el (ruby-exit!-font-lock):
=== modified file 'test/automated/Makefile.in'
--- a/test/automated/Makefile.in 2013-11-21 01:31:33 +0000
+++ b/test/automated/Makefile.in 2013-11-23 01:55:16 +0000
@@ -43,8 +43,7 @@
# The actual Emacs command run in the targets below.
# Prevent any setting of EMACSLOADPATH in user environment causing problems.
-emacs = unset EMACSLOADPATH; \
- LC_ALL=C EMACS_TEST_DIRECTORY=$(srcdir) "$(EMACS)" $(EMACSOPT)
+emacs = EMACSLOADPATH= LC_ALL=C EMACS_TEST_DIRECTORY=$(srcdir) "$(EMACS)"
$(EMACSOPT)
# Common command to find subdirectories
setwins=for file in `find $(srcdir) -type d -print`; do \
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] trunk r115192: Empty elements in EMACSLOADPATH now stand for the default,
Glenn Morris <=