aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Morris2013-11-22 17:55:16 -0800
committerGlenn Morris2013-11-22 17:55:16 -0800
commit17e0445be4a6a4f437f4be4924074c90d6477481 (patch)
treec78a4df4e1c2f9daf840c96d15dc9e00dd71c68d
parent72648ef2605b654caf515ef020c2cac70cd0d741 (diff)
downloademacs-17e0445be4a6a4f437f4be4924074c90d6477481.tar.gz
emacs-17e0445be4a6a4f437f4be4924074c90d6477481.zip
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. Fixes: debbugs:12100
-rw-r--r--doc/emacs/ChangeLog5
-rw-r--r--doc/emacs/cmdargs.texi11
-rw-r--r--doc/lispref/ChangeLog5
-rw-r--r--doc/lispref/loading.texi33
-rw-r--r--etc/NEWS10
-rw-r--r--leim/ChangeLog4
-rw-r--r--leim/Makefile.in3
-rw-r--r--lisp/ChangeLog4
-rw-r--r--lisp/Makefile.in2
-rw-r--r--src/ChangeLog16
-rw-r--r--src/callproc.c16
-rw-r--r--src/emacs.c61
-rw-r--r--src/image.c2
-rw-r--r--src/lisp.h5
-rw-r--r--src/lread.c224
-rw-r--r--test/ChangeLog5
-rw-r--r--test/automated/Makefile.in3
17 files changed, 253 insertions, 156 deletions
diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog
index 229929d132d..a0d5344641e 100644
--- a/doc/emacs/ChangeLog
+++ b/doc/emacs/ChangeLog
@@ -1,3 +1,8 @@
12013-11-23 Glenn Morris <rgm@gnu.org>
2
3 * cmdargs.texi (General Variables):
4 Empty elements in EMACSLOADPATH now mean the default load-path.
5
12013-11-21 Glenn Morris <rgm@gnu.org> 62013-11-21 Glenn Morris <rgm@gnu.org>
2 7
3 * cmdargs.texi (Action Arguments): Use path-separator with -L. 8 * cmdargs.texi (Action Arguments): Use path-separator with -L.
diff --git a/doc/emacs/cmdargs.texi b/doc/emacs/cmdargs.texi
index 92861c443f1..4294f775e5e 100644
--- a/doc/emacs/cmdargs.texi
+++ b/doc/emacs/cmdargs.texi
@@ -455,13 +455,16 @@ This is used to initialize the variable @code{data-directory}.
455Directory for the documentation string file, which is used to 455Directory for the documentation string file, which is used to
456initialize the Lisp variable @code{doc-directory}. 456initialize the Lisp variable @code{doc-directory}.
457@item EMACSLOADPATH 457@item EMACSLOADPATH
458A colon-separated list of directories@footnote{ Here and below, 458A colon-separated list of directories@footnote{Here and below,
459whenever we say ``colon-separated list of directories'', it pertains 459whenever we say ``colon-separated list of directories'', it pertains
460to Unix and GNU/Linux systems. On MS-DOS and MS-Windows, the 460to Unix and GNU/Linux systems. On MS-DOS and MS-Windows, the
461directories are separated by semi-colons instead, since DOS/Windows 461directories are separated by semi-colons instead, since DOS/Windows
462file names might include a colon after a drive letter.} to search for 462file names might include a colon after a drive letter.} to search for
463Emacs Lisp files. If set, it overrides the usual initial value of the 463Emacs Lisp files. If set, it modifies the usual initial value of the
464@code{load-path} variable (@pxref{Lisp Libraries}). 464@code{load-path} variable (@pxref{Lisp Libraries}). An empty element
465stands for the default value of @code{load-path}; e.g., using
466@samp{EMACSLOADPATH="/tmp:"} adds @file{/tmp} to the front of
467the default @code{load-path}.
465@item EMACSPATH 468@item EMACSPATH
466A colon-separated list of directories to search for executable files. 469A colon-separated list of directories to search for executable files.
467If set, Emacs uses this in addition to @env{PATH} (see below) when 470If set, Emacs uses this in addition to @env{PATH} (see below) when
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog
index 8a082a851c9..5251efec3e4 100644
--- a/doc/lispref/ChangeLog
+++ b/doc/lispref/ChangeLog
@@ -1,3 +1,8 @@
12013-11-23 Glenn Morris <rgm@gnu.org>
2
3 * loading.texi (Library Search):
4 Empty elements in EMACSLOADPATH now mean the default load-path.
5
12013-11-22 Glenn Morris <rgm@gnu.org> 62013-11-22 Glenn Morris <rgm@gnu.org>
2 7
3 * loading.texi (Library Search): Minor clarification. 8 * loading.texi (Library Search): Minor clarification.
diff --git a/doc/lispref/loading.texi b/doc/lispref/loading.texi
index 38a73b4e296..aae92de99cb 100644
--- a/doc/lispref/loading.texi
+++ b/doc/lispref/loading.texi
@@ -310,25 +310,34 @@ directories, if they exist. Normally these directories do not contain
310@file{site-lisp} directories.) 310@file{site-lisp} directories.)
311 311
312@cindex @env{EMACSLOADPATH} environment variable 312@cindex @env{EMACSLOADPATH} environment variable
313If the environment variable @env{EMACSLOADPATH} is set, it overrides 313If the environment variable @env{EMACSLOADPATH} is set, it modifies
314the above initialization procedure. That is, Emacs initializes 314the above initialization procedure. Emacs initializes
315@code{load-path} based solely on the value of the environment 315@code{load-path} based on the value of the environment variable.
316variable. You must therefore include the directory containing the
317standard Lisp files, else Emacs will not function. In most
318situations, it is better to use the @option{-L} command-line option
319(see below) to add elements to @code{load-path}.
320 316
321The syntax of @env{EMACSLOADPATH} is the same as used for @code{PATH}; 317The syntax of @env{EMACSLOADPATH} is the same as used for @code{PATH};
322directory names are separated by @samp{:} (or @samp{;}, on some 318directory names are separated by @samp{:} (or @samp{;}, on some
323operating systems), and @samp{.} stands for the current default 319operating systems).
324directory. Here is an example of how to set @env{EMACSLOADPATH} 320@ignore
325variable (from a @command{sh}-style shell): 321@c AFAICS, does not (yet) work right to specify non-absolute elements.
322and @samp{.} stands for the current default directory.
323@end ignore
324Here is an example of how to set @env{EMACSLOADPATH} variable (from a
325@command{sh}-style shell):
326 326
327@example 327@example
328export EMACSLOADPATH 328export EMACSLOADPATH=/home/foo/.emacs.d/lisp:
329EMACSLOADPATH=/home/foo/.emacs.d/lisp:/usr/local/emacs/24.3/lisp
330@end example 329@end example
331 330
331An empty element in the value of the environment variable, whether
332trailing (as in the above example), leading, or embedded, is replaced
333by the default value of @code{load-path} as determined by the standard
334initialization procedure. If there are no such empty elements, then
335@env{EMACSLOADPATH} specifies the entire @code{load-path}. You must
336include either an empty element, or the explicit path to the directory
337containing the standard Lisp files, else Emacs will not function.
338(Another way to modify @code{load-path} is to use the @option{-L}
339command-line option when starting Emacs; see below.)
340
332 For each directory in @code{load-path}, Emacs then checks to see if 341 For each directory in @code{load-path}, Emacs then checks to see if
333it contains a file @file{subdirs.el}, and if so, loads it. The 342it contains a file @file{subdirs.el}, and if so, loads it. The
334@file{subdirs.el} file is created when Emacs is built/installed, 343@file{subdirs.el} file is created when Emacs is built/installed,
diff --git a/etc/NEWS b/etc/NEWS
index 97ae6c79d20..4dc1543d845 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -63,6 +63,16 @@ To use the old backend by default, do on the command line:
63* Startup Changes in Emacs 24.4 63* Startup Changes in Emacs 24.4
64 64
65+++ 65+++
66** When initializing `load-path', an empty element in the EMACSLOADPATH
67environment variable (either leading, e.g., ":/foo"; trailing, e.g.,
68"/foo:"; or embedded, e.g., "/foo::/bar") is replaced with the default
69load-path (the one that would have been used if EMACSLOADPATH was unset).
70This makes it easier to _extend_ the load-path via EMACSLOADPATH
71(previously, EMACSLOADPATH had to specify the complete load-path,
72including the defaults). (In older versions of Emacs, an empty element
73was replaced by ".", so use an explicit "." now if that is what you want.)
74
75+++
66** The -L option, which normally prepends its argument to load-path, 76** The -L option, which normally prepends its argument to load-path,
67will instead append, if the argument begins with `:' (or `;' on MS Windows; 77will instead append, if the argument begins with `:' (or `;' on MS Windows;
68i.e., `path-separator'). 78i.e., `path-separator').
diff --git a/leim/ChangeLog b/leim/ChangeLog
index 6b16d71c215..ec5d9958151 100644
--- a/leim/ChangeLog
+++ b/leim/ChangeLog
@@ -1,3 +1,7 @@
12013-11-23 Glenn Morris <rgm@gnu.org>
2
3 * Makefile.in (RUN_EMACS): Empty EMACSLOADPATH rather than unsetting.
4
12013-11-04 Eli Zaretskii <eliz@gnu.org> 52013-11-04 Eli Zaretskii <eliz@gnu.org>
2 6
3 * Makefile.in (RUN_EMACS): Don't set LC_ALL=C. (Bug#15260) 7 * Makefile.in (RUN_EMACS): Don't set LC_ALL=C. (Bug#15260)
diff --git a/leim/Makefile.in b/leim/Makefile.in
index a5c05d567ec..5a6f2ff4795 100644
--- a/leim/Makefile.in
+++ b/leim/Makefile.in
@@ -32,8 +32,7 @@ EMACS = ../src/emacs
32 32
33# How to run Emacs. 33# How to run Emacs.
34# Prevent any setting of EMACSLOADPATH in user environment causing problems. 34# Prevent any setting of EMACSLOADPATH in user environment causing problems.
35RUN_EMACS = unset EMACSLOADPATH; "${EMACS}" -batch \ 35RUN_EMACS = EMACSLOADPATH= "${EMACS}" -batch --no-site-file --no-site-lisp
36 --no-site-file --no-site-lisp
37 36
38MKDIR_P = @MKDIR_P@ 37MKDIR_P = @MKDIR_P@
39 38
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index f9b6f6ee356..97f4c007c72 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,7 @@
12013-11-23 Glenn Morris <rgm@gnu.org>
2
3 * Makefile.in (emacs): Empty EMACSLOADPATH rather than unsetting.
4
12013-11-22 Leo Liu <sdl.web@gmail.com> 52013-11-22 Leo Liu <sdl.web@gmail.com>
2 6
3 * progmodes/octave.el (inferior-octave-startup): Spit out error 7 * progmodes/octave.el (inferior-octave-startup): Spit out error
diff --git a/lisp/Makefile.in b/lisp/Makefile.in
index d00330c3a9b..eb52b317e7b 100644
--- a/lisp/Makefile.in
+++ b/lisp/Makefile.in
@@ -106,7 +106,7 @@ COMPILE_FIRST = \
106 106
107# The actual Emacs command run in the targets below. 107# The actual Emacs command run in the targets below.
108# Prevent any setting of EMACSLOADPATH in user environment causing problems. 108# Prevent any setting of EMACSLOADPATH in user environment causing problems.
109emacs = unset EMACSLOADPATH; "$(EMACS)" $(EMACSOPT) 109emacs = EMACSLOADPATH= "$(EMACS)" $(EMACSOPT)
110 110
111# Common command to find subdirectories 111# Common command to find subdirectories
112setwins=for file in `find . -type d -print`; do \ 112setwins=for file in `find . -type d -print`; do \
diff --git a/src/ChangeLog b/src/ChangeLog
index 994ea2d3de5..823a70326bb 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,19 @@
12013-11-23 Glenn Morris <rgm@gnu.org>
2
3 Empty elements in EMACSLOADPATH stand for the default. (Bug#12100)
4 * lread.c (load_path_check): Take path to check as argument.
5 (load_path_default): New, split from init_lread.
6 (init_lread): Move calc of default load-path to load_path_default.
7 Empty elements in EMACSLOADPATH now stand for the default.
8 (load-path): Doc fix.
9 * emacs.c (decode_env_path): Add option to treat empty elements
10 as nil rather than ".".
11 * callproc.c (init_callproc_1, init_callproc):
12 * image.c (Vx_bitmap_file_path):
13 * lisp.h (decode_env_path):
14 * lread.c (Vsource_directory):
15 Update for new argument spec of decode_env_path.
16
12013-11-22 Eli Zaretskii <eliz@gnu.org> 172013-11-22 Eli Zaretskii <eliz@gnu.org>
2 18
3 * bidi.c (bidi_find_paragraph_start): Limit the returned positions 19 * bidi.c (bidi_find_paragraph_start): Limit the returned positions
diff --git a/src/callproc.c b/src/callproc.c
index 3317c1203bc..dfe315ab8db 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -1,6 +1,6 @@
1/* Synchronous subprocess invocation for GNU Emacs. 1/* Synchronous subprocess invocation for GNU Emacs.
2 Copyright (C) 1985-1988, 1993-1995, 1999-2013 2
3 Free Software Foundation, Inc. 3Copyright (C) 1985-1988, 1993-1995, 1999-2013 Free Software Foundation, Inc.
4 4
5This file is part of GNU Emacs. 5This file is part of GNU Emacs.
6 6
@@ -1520,14 +1520,14 @@ init_callproc_1 (void)
1520#ifdef HAVE_NS 1520#ifdef HAVE_NS
1521 etc_dir ? etc_dir : 1521 etc_dir ? etc_dir :
1522#endif 1522#endif
1523 PATH_DATA); 1523 PATH_DATA, 0);
1524 Vdata_directory = Ffile_name_as_directory (Fcar (Vdata_directory)); 1524 Vdata_directory = Ffile_name_as_directory (Fcar (Vdata_directory));
1525 1525
1526 Vdoc_directory = decode_env_path ("EMACSDOC", 1526 Vdoc_directory = decode_env_path ("EMACSDOC",
1527#ifdef HAVE_NS 1527#ifdef HAVE_NS
1528 etc_dir ? etc_dir : 1528 etc_dir ? etc_dir :
1529#endif 1529#endif
1530 PATH_DOC); 1530 PATH_DOC, 0);
1531 Vdoc_directory = Ffile_name_as_directory (Fcar (Vdoc_directory)); 1531 Vdoc_directory = Ffile_name_as_directory (Fcar (Vdoc_directory));
1532 1532
1533 /* Check the EMACSPATH environment variable, defaulting to the 1533 /* Check the EMACSPATH environment variable, defaulting to the
@@ -1536,10 +1536,10 @@ init_callproc_1 (void)
1536#ifdef HAVE_NS 1536#ifdef HAVE_NS
1537 path_exec ? path_exec : 1537 path_exec ? path_exec :
1538#endif 1538#endif
1539 PATH_EXEC); 1539 PATH_EXEC, 0);
1540 Vexec_directory = Ffile_name_as_directory (Fcar (Vexec_path)); 1540 Vexec_directory = Ffile_name_as_directory (Fcar (Vexec_path));
1541 /* FIXME? For ns, path_exec should go at the front? */ 1541 /* FIXME? For ns, path_exec should go at the front? */
1542 Vexec_path = nconc2 (decode_env_path ("PATH", ""), Vexec_path); 1542 Vexec_path = nconc2 (decode_env_path ("PATH", "", 0), Vexec_path);
1543} 1543}
1544 1544
1545/* This is run after init_cmdargs, when Vinstallation_directory is valid. */ 1545/* This is run after init_cmdargs, when Vinstallation_directory is valid. */
@@ -1580,9 +1580,9 @@ init_callproc (void)
1580#ifdef HAVE_NS 1580#ifdef HAVE_NS
1581 path_exec ? path_exec : 1581 path_exec ? path_exec :
1582#endif 1582#endif
1583 PATH_EXEC); 1583 PATH_EXEC, 0);
1584 Vexec_path = Fcons (tem, Vexec_path); 1584 Vexec_path = Fcons (tem, Vexec_path);
1585 Vexec_path = nconc2 (decode_env_path ("PATH", ""), Vexec_path); 1585 Vexec_path = nconc2 (decode_env_path ("PATH", "", 0), Vexec_path);
1586 } 1586 }
1587 1587
1588 Vexec_directory = Ffile_name_as_directory (tem); 1588 Vexec_directory = Ffile_name_as_directory (tem);
diff --git a/src/emacs.c b/src/emacs.c
index 52d2e76dc87..75082ecef7d 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -2167,10 +2167,13 @@ synchronize_system_messages_locale (void)
2167 2167
2168 2168
2169Lisp_Object 2169Lisp_Object
2170decode_env_path (const char *evarname, const char *defalt) 2170decode_env_path (const char *evarname, const char *defalt, bool empty)
2171{ 2171{
2172 const char *path, *p; 2172 const char *path, *p;
2173 Lisp_Object lpath, element, tem; 2173 Lisp_Object lpath, element, tem;
2174 /* Default is to use "." for empty path elements.
2175 But if argument EMPTY is true, use nil instead. */
2176 Lisp_Object empty_element = empty ? Qnil : build_string (".");
2174#ifdef WINDOWSNT 2177#ifdef WINDOWSNT
2175 bool defaulted = 0; 2178 bool defaulted = 0;
2176 const char *emacs_dir = egetenv ("emacs_dir"); 2179 const char *emacs_dir = egetenv ("emacs_dir");
@@ -2209,34 +2212,38 @@ decode_env_path (const char *evarname, const char *defalt)
2209 if (!p) 2212 if (!p)
2210 p = path + strlen (path); 2213 p = path + strlen (path);
2211 element = (p - path ? make_unibyte_string (path, p - path) 2214 element = (p - path ? make_unibyte_string (path, p - path)
2212 : build_string (".")); 2215 : empty_element);
2216 if (! NILP (element))
2217 {
2213#ifdef WINDOWSNT 2218#ifdef WINDOWSNT
2214 /* Relative file names in the default path are interpreted as 2219 /* Relative file names in the default path are interpreted as
2215 being relative to $emacs_dir. */ 2220 being relative to $emacs_dir. */
2216 if (emacs_dir && defaulted 2221 if (emacs_dir && defaulted
2217 && strncmp (path, emacs_dir_env, emacs_dir_len) == 0) 2222 && strncmp (path, emacs_dir_env, emacs_dir_len) == 0)
2218 element = Fexpand_file_name (Fsubstring (element, 2223 element = Fexpand_file_name (Fsubstring
2219 make_number (emacs_dir_len), 2224 (element,
2220 Qnil), 2225 make_number (emacs_dir_len),
2221 build_unibyte_string (emacs_dir)); 2226 Qnil),
2222#endif 2227 build_unibyte_string (emacs_dir));
2223 2228#endif
2224 /* Add /: to the front of the name 2229
2225 if it would otherwise be treated as magic. */ 2230 /* Add /: to the front of the name
2226 tem = Ffind_file_name_handler (element, Qt); 2231 if it would otherwise be treated as magic. */
2227 2232 tem = Ffind_file_name_handler (element, Qt);
2228 /* However, if the handler says "I'm safe", 2233
2229 don't bother adding /:. */ 2234 /* However, if the handler says "I'm safe",
2230 if (SYMBOLP (tem)) 2235 don't bother adding /:. */
2231 { 2236 if (SYMBOLP (tem))
2232 Lisp_Object prop; 2237 {
2233 prop = Fget (tem, intern ("safe-magic")); 2238 Lisp_Object prop;
2234 if (! NILP (prop)) 2239 prop = Fget (tem, intern ("safe-magic"));
2235 tem = Qnil; 2240 if (! NILP (prop))
2236 } 2241 tem = Qnil;
2242 }
2237 2243
2238 if (! NILP (tem)) 2244 if (! NILP (tem))
2239 element = concat2 (build_string ("/:"), element); 2245 element = concat2 (build_string ("/:"), element);
2246 } /* !NILP (element) */
2240 2247
2241 lpath = Fcons (element, lpath); 2248 lpath = Fcons (element, lpath);
2242 if (*p) 2249 if (*p)
diff --git a/src/image.c b/src/image.c
index 37a19e4f5a5..167ee2da303 100644
--- a/src/image.c
+++ b/src/image.c
@@ -9502,7 +9502,7 @@ A cross is always drawn on black & white displays. */);
9502 9502
9503 DEFVAR_LISP ("x-bitmap-file-path", Vx_bitmap_file_path, 9503 DEFVAR_LISP ("x-bitmap-file-path", Vx_bitmap_file_path,
9504 doc: /* List of directories to search for window system bitmap files. */); 9504 doc: /* List of directories to search for window system bitmap files. */);
9505 Vx_bitmap_file_path = decode_env_path (0, PATH_BITMAPS); 9505 Vx_bitmap_file_path = decode_env_path (0, PATH_BITMAPS, 0);
9506 9506
9507 DEFVAR_LISP ("image-cache-eviction-delay", Vimage_cache_eviction_delay, 9507 DEFVAR_LISP ("image-cache-eviction-delay", Vimage_cache_eviction_delay,
9508 doc: /* Maximum time after which images are removed from the cache. 9508 doc: /* Maximum time after which images are removed from the cache.
diff --git a/src/lisp.h b/src/lisp.h
index a9aac2cc0bb..376235a402d 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -1,7 +1,6 @@
1/* Fundamental definitions for GNU Emacs Lisp interpreter. 1/* Fundamental definitions for GNU Emacs Lisp interpreter.
2 2
3Copyright (C) 1985-1987, 1993-1995, 1997-2013 Free Software Foundation, 3Copyright (C) 1985-1987, 1993-1995, 1997-2013 Free Software Foundation, Inc.
4Inc.
5 4
6This file is part of GNU Emacs. 5This file is part of GNU Emacs.
7 6
@@ -4058,7 +4057,7 @@ extern int initial_argc;
4058#if defined (HAVE_X_WINDOWS) || defined (HAVE_NS) 4057#if defined (HAVE_X_WINDOWS) || defined (HAVE_NS)
4059extern bool display_arg; 4058extern bool display_arg;
4060#endif 4059#endif
4061extern Lisp_Object decode_env_path (const char *, const char *); 4060extern Lisp_Object decode_env_path (const char *, const char *, bool);
4062extern Lisp_Object empty_unibyte_string, empty_multibyte_string; 4061extern Lisp_Object empty_unibyte_string, empty_multibyte_string;
4063extern Lisp_Object Qfile_name_handler_alist; 4062extern Lisp_Object Qfile_name_handler_alist;
4064extern _Noreturn void terminate_due_to_signal (int, int); 4063extern _Noreturn void terminate_due_to_signal (int, int);
diff --git a/src/lread.c b/src/lread.c
index 6c1b17f62b7..17ca02d36c7 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -1,7 +1,6 @@
1/* Lisp parsing and input streams. 1/* Lisp parsing and input streams.
2 2
3Copyright (C) 1985-1989, 1993-1995, 1997-2013 Free Software Foundation, 3Copyright (C) 1985-1989, 1993-1995, 1997-2013 Free Software Foundation, Inc.
4Inc.
5 4
6This file is part of GNU Emacs. 5This file is part of GNU Emacs.
7 6
@@ -4106,17 +4105,17 @@ defvar_kboard (struct Lisp_Kboard_Objfwd *ko_fwd,
4106 SET_SYMBOL_FWD (XSYMBOL (sym), (union Lisp_Fwd *)ko_fwd); 4105 SET_SYMBOL_FWD (XSYMBOL (sym), (union Lisp_Fwd *)ko_fwd);
4107} 4106}
4108 4107
4109/* Check that the elements of Vload_path exist. */ 4108/* Check that the elements of lpath exist. */
4110 4109
4111static void 4110static void
4112load_path_check (void) 4111load_path_check (Lisp_Object lpath)
4113{ 4112{
4114 Lisp_Object path_tail; 4113 Lisp_Object path_tail;
4115 4114
4116 /* The only elements that might not exist are those from 4115 /* The only elements that might not exist are those from
4117 PATH_LOADSEARCH, EMACSLOADPATH. Anything else is only added if 4116 PATH_LOADSEARCH, EMACSLOADPATH. Anything else is only added if
4118 it exists. */ 4117 it exists. */
4119 for (path_tail = Vload_path; !NILP (path_tail); path_tail = XCDR (path_tail)) 4118 for (path_tail = lpath; !NILP (path_tail); path_tail = XCDR (path_tail))
4120 { 4119 {
4121 Lisp_Object dirfile; 4120 Lisp_Object dirfile;
4122 dirfile = Fcar (path_tail); 4121 dirfile = Fcar (path_tail);
@@ -4133,19 +4132,23 @@ load_path_check (void)
4133 so we can see if the site changed it later during dumping. */ 4132 so we can see if the site changed it later during dumping. */
4134static Lisp_Object dump_path; 4133static Lisp_Object dump_path;
4135 4134
4136/* Compute the default Vload_path, with the following logic: 4135/* Return the default load-path, to be used if EMACSLOADPATH is unset.
4137 If CANNOT_DUMP: 4136 This does not include the standard site-lisp directories
4138 use EMACSLOADPATH env-var if set; otherwise use PATH_LOADSEARCH, 4137 under the installation prefix (i.e., PATH_SITELOADSEARCH),
4139 prepending PATH_SITELOADSEARCH unless --no-site-lisp. 4138 but it does (unless no_site_lisp is set) include site-lisp
4139 directories in the source/build directories if those exist and we
4140 are running uninstalled.
4141
4142 Uses the following logic:
4143 If CANNOT_DUMP: Use PATH_LOADSEARCH.
4140 The remainder is what happens when dumping works: 4144 The remainder is what happens when dumping works:
4141 If purify-flag (ie dumping) just use PATH_DUMPLOADSEARCH. 4145 If purify-flag (ie dumping) just use PATH_DUMPLOADSEARCH.
4142 Otherwise use EMACSLOADPATH if set, else PATH_LOADSEARCH. 4146 Otherwise use PATH_LOADSEARCH.
4143 4147
4144 If !initialized, then just set both Vload_path and dump_path. 4148 If !initialized, then just set dump_path and return PATH_DUMPLOADSEARCH.
4145 If initialized, then if Vload_path != dump_path, do nothing. 4149 If initialized, then if Vload_path != dump_path, return just Vload_path.
4146 (Presumably the load-path has already been changed by something. 4150 (Presumably the load-path has already been changed by something.
4147 This can only be from a site-load file during dumping, 4151 This can only be from a site-load file during dumping.)
4148 or because EMACSLOADPATH is set.)
4149 If Vinstallation_directory is not nil (ie, running uninstalled): 4152 If Vinstallation_directory is not nil (ie, running uninstalled):
4150 If installation-dir/lisp exists and not already a member, 4153 If installation-dir/lisp exists and not already a member,
4151 we must be running uninstalled. Reset the load-path 4154 we must be running uninstalled. Reset the load-path
@@ -4162,12 +4165,11 @@ static Lisp_Object dump_path;
4162 install-dir/src/Makefile.in does NOT exist (this is a sanity 4165 install-dir/src/Makefile.in does NOT exist (this is a sanity
4163 check), then repeat the above steps for source-dir/lisp, 4166 check), then repeat the above steps for source-dir/lisp,
4164 leim and site-lisp. 4167 leim and site-lisp.
4165 Finally, add the site-lisp directories at the front (if !no_site_lisp).
4166*/ 4168*/
4167 4169Lisp_Object
4168void 4170load_path_default (bool ignore_existing)
4169init_lread (void)
4170{ 4171{
4172 Lisp_Object lpath = Qnil;
4171 const char *normal; 4173 const char *normal;
4172 4174
4173#ifdef CANNOT_DUMP 4175#ifdef CANNOT_DUMP
@@ -4177,35 +4179,14 @@ init_lread (void)
4177 4179
4178 normal = PATH_LOADSEARCH; 4180 normal = PATH_LOADSEARCH;
4179#ifdef HAVE_NS 4181#ifdef HAVE_NS
4180 Vload_path = decode_env_path ("EMACSLOADPATH", loadpath ? loadpath : normal); 4182 lpath = decode_env_path (0, loadpath ? loadpath : normal, 0);
4181#else 4183#else
4182 Vload_path = decode_env_path ("EMACSLOADPATH", normal); 4184 lpath = decode_env_path (0, normal, 0);
4183#endif 4185#endif
4184 4186
4185 load_path_check ();
4186
4187 /* FIXME CANNOT_DUMP platforms should get source-dir/lisp etc added
4188 to their load-path too, AFAICS. I don't think we can tell the
4189 difference between initialized and !initialized in this case,
4190 so we'll have to do it unconditionally when Vinstallation_directory
4191 is non-nil. */
4192 if (!no_site_lisp && !egetenv ("EMACSLOADPATH"))
4193 {
4194 Lisp_Object sitelisp;
4195 sitelisp = decode_env_path (0, PATH_SITELOADSEARCH);
4196 if (! NILP (sitelisp)) Vload_path = nconc2 (sitelisp, Vload_path);
4197 }
4198#else /* !CANNOT_DUMP */ 4187#else /* !CANNOT_DUMP */
4199 if (NILP (Vpurify_flag)) 4188
4200 { 4189 normal = NILP (Vpurify_flag) ? PATH_LOADSEARCH : PATH_DUMPLOADSEARCH;
4201 normal = PATH_LOADSEARCH;
4202 /* If the EMACSLOADPATH environment variable is set, use its value.
4203 This doesn't apply if we're dumping. */
4204 if (egetenv ("EMACSLOADPATH"))
4205 Vload_path = decode_env_path ("EMACSLOADPATH", normal);
4206 }
4207 else
4208 normal = PATH_DUMPLOADSEARCH;
4209 4190
4210 /* In a dumped Emacs, we normally reset the value of Vload_path using 4191 /* In a dumped Emacs, we normally reset the value of Vload_path using
4211 PATH_LOADSEARCH, since the value that was dumped uses lisp/ in 4192 PATH_LOADSEARCH, since the value that was dumped uses lisp/ in
@@ -4216,24 +4197,22 @@ init_lread (void)
4216 site-lisp files that were processed during dumping. */ 4197 site-lisp files that were processed during dumping. */
4217 if (initialized) 4198 if (initialized)
4218 { 4199 {
4219 if (NILP (Fequal (dump_path, Vload_path))) 4200 if (!ignore_existing && NILP (Fequal (dump_path, Vload_path)))
4220 { 4201 {
4221 /* Do not make any changes, just check the elements exist. */ 4202 /* Do not make any changes. */
4222 /* Note: --no-site-lisp is ignored. 4203 return Vload_path;
4223 I don't know what to do about this. */
4224 load_path_check ();
4225 } 4204 }
4226 else 4205 else
4227 { 4206 {
4228#ifdef HAVE_NS 4207#ifdef HAVE_NS
4229 const char *loadpath = ns_load_path (); 4208 const char *loadpath = ns_load_path ();
4230 Vload_path = decode_env_path (0, loadpath ? loadpath : normal); 4209 lpath = decode_env_path (0, loadpath ? loadpath : normal, 0);
4231#else 4210#else
4232 Vload_path = decode_env_path (0, normal); 4211 lpath = decode_env_path (0, normal, 0);
4233#endif 4212#endif
4234 if (!NILP (Vinstallation_directory)) 4213 if (!NILP (Vinstallation_directory))
4235 { 4214 {
4236 Lisp_Object tem, tem1; 4215 Lisp_Object tem, tem1;
4237 4216
4238 /* Add to the path the lisp subdir of the installation 4217 /* Add to the path the lisp subdir of the installation
4239 dir, if it is accessible. Note: in out-of-tree builds, 4218 dir, if it is accessible. Note: in out-of-tree builds,
@@ -4243,19 +4222,19 @@ init_lread (void)
4243 tem1 = Ffile_accessible_directory_p (tem); 4222 tem1 = Ffile_accessible_directory_p (tem);
4244 if (!NILP (tem1)) 4223 if (!NILP (tem1))
4245 { 4224 {
4246 if (NILP (Fmember (tem, Vload_path))) 4225 if (NILP (Fmember (tem, lpath)))
4247 { 4226 {
4248 /* We are running uninstalled. The default load-path 4227 /* We are running uninstalled. The default load-path
4249 points to the eventual installed lisp, leim 4228 points to the eventual installed lisp, leim
4250 directories. We should not use those now, even 4229 directories. We should not use those now, even
4251 if they exist, so start over from a clean slate. */ 4230 if they exist, so start over from a clean slate. */
4252 Vload_path = list1 (tem); 4231 lpath = list1 (tem);
4253 } 4232 }
4254 } 4233 }
4255 else 4234 else
4256 /* That dir doesn't exist, so add the build-time 4235 /* That dir doesn't exist, so add the build-time
4257 Lisp dirs instead. */ 4236 Lisp dirs instead. */
4258 Vload_path = nconc2 (Vload_path, dump_path); 4237 lpath = nconc2 (lpath, dump_path);
4259 4238
4260 /* Add leim under the installation dir, if it is accessible. */ 4239 /* Add leim under the installation dir, if it is accessible. */
4261 tem = Fexpand_file_name (build_string ("leim"), 4240 tem = Fexpand_file_name (build_string ("leim"),
@@ -4263,8 +4242,8 @@ init_lread (void)
4263 tem1 = Ffile_accessible_directory_p (tem); 4242 tem1 = Ffile_accessible_directory_p (tem);
4264 if (!NILP (tem1)) 4243 if (!NILP (tem1))
4265 { 4244 {
4266 if (NILP (Fmember (tem, Vload_path))) 4245 if (NILP (Fmember (tem, lpath)))
4267 Vload_path = Fcons (tem, Vload_path); 4246 lpath = Fcons (tem, lpath);
4268 } 4247 }
4269 4248
4270 /* Add site-lisp under the installation dir, if it exists. */ 4249 /* Add site-lisp under the installation dir, if it exists. */
@@ -4275,8 +4254,8 @@ init_lread (void)
4275 tem1 = Ffile_accessible_directory_p (tem); 4254 tem1 = Ffile_accessible_directory_p (tem);
4276 if (!NILP (tem1)) 4255 if (!NILP (tem1))
4277 { 4256 {
4278 if (NILP (Fmember (tem, Vload_path))) 4257 if (NILP (Fmember (tem, lpath)))
4279 Vload_path = Fcons (tem, Vload_path); 4258 lpath = Fcons (tem, lpath);
4280 } 4259 }
4281 } 4260 }
4282 4261
@@ -4304,14 +4283,14 @@ init_lread (void)
4304 tem = Fexpand_file_name (build_string ("lisp"), 4283 tem = Fexpand_file_name (build_string ("lisp"),
4305 Vsource_directory); 4284 Vsource_directory);
4306 4285
4307 if (NILP (Fmember (tem, Vload_path))) 4286 if (NILP (Fmember (tem, lpath)))
4308 Vload_path = Fcons (tem, Vload_path); 4287 lpath = Fcons (tem, lpath);
4309 4288
4310 tem = Fexpand_file_name (build_string ("leim"), 4289 tem = Fexpand_file_name (build_string ("leim"),
4311 Vsource_directory); 4290 Vsource_directory);
4312 4291
4313 if (NILP (Fmember (tem, Vload_path))) 4292 if (NILP (Fmember (tem, lpath)))
4314 Vload_path = Fcons (tem, Vload_path); 4293 lpath = Fcons (tem, lpath);
4315 4294
4316 if (!no_site_lisp) 4295 if (!no_site_lisp)
4317 { 4296 {
@@ -4320,47 +4299,101 @@ init_lread (void)
4320 tem1 = Ffile_accessible_directory_p (tem); 4299 tem1 = Ffile_accessible_directory_p (tem);
4321 if (!NILP (tem1)) 4300 if (!NILP (tem1))
4322 { 4301 {
4323 if (NILP (Fmember (tem, Vload_path))) 4302 if (NILP (Fmember (tem, lpath)))
4324 Vload_path = Fcons (tem, Vload_path); 4303 lpath = Fcons (tem, lpath);
4325 } 4304 }
4326 } 4305 }
4327 } 4306 }
4328 } /* Vinstallation_directory != Vsource_directory */ 4307 } /* Vinstallation_directory != Vsource_directory */
4329 4308
4330 } /* if Vinstallation_directory */ 4309 } /* if Vinstallation_directory */
4331
4332 /* Check before adding the site-lisp directories.
4333 The install should have created them, but they are not
4334 required, so no need to warn if they are absent.
4335 Or we might be running before installation. */
4336 load_path_check ();
4337 4310
4338 /* Add the site-lisp directories at the front. */ 4311 } /* if dump_path == Vload_path */
4339 if (!no_site_lisp)
4340 {
4341 Lisp_Object sitelisp;
4342 sitelisp = decode_env_path (0, PATH_SITELOADSEARCH);
4343 if (! NILP (sitelisp)) Vload_path = nconc2 (sitelisp, Vload_path);
4344 }
4345 } /* if dump_path == Vload_path */
4346 } 4312 }
4347 else /* !initialized */ 4313 else /* !initialized */
4348 { 4314 {
4349 /* NORMAL refers to PATH_DUMPLOADSEARCH, ie the lisp dir in the 4315 /* NORMAL refers to PATH_DUMPLOADSEARCH, ie the lisp dir in the
4350 source directory. We used to add ../lisp (ie the lisp dir in 4316 source directory. We used to add ../lisp (ie the lisp dir in
4351 the build directory) at the front here, but that caused trouble 4317 the build directory) at the front here, but that caused trouble
4352 because it was copied from dump_path into Vload_path, above, 4318 because it was copied from dump_path into Vload_path, above,
4353 when Vinstallation_directory was non-nil. It should not be 4319 when Vinstallation_directory was non-nil. It should not be
4354 necessary, since in out of tree builds lisp/ is empty, save 4320 necessary, since in out of tree builds lisp/ is empty, save
4355 for Makefile. */ 4321 for Makefile. */
4356 Vload_path = decode_env_path (0, normal); 4322 lpath = decode_env_path (0, normal, 0);
4357 dump_path = Vload_path; 4323 dump_path = lpath;
4358 /* No point calling load_path_check; load-path only contains essential
4359 elements from the source directory at this point. They cannot
4360 be missing unless something went extremely (and improbably)
4361 wrong, in which case the build will fail in obvious ways. */
4362 } 4324 }
4363#endif /* !CANNOT_DUMP */ 4325#endif /* !CANNOT_DUMP */
4326
4327 return lpath;
4328}
4329
4330void
4331init_lread (void)
4332{
4333 /* First, set Vload_path. */
4334
4335 /* We explicitly ignore EMACSLOADPATH when dumping. */
4336 if (NILP (Vpurify_flag) && egetenv ("EMACSLOADPATH"))
4337 {
4338 Vload_path = decode_env_path ("EMACSLOADPATH", 0, 1);
4339
4340 /* Check (non-nil) user-supplied elements. */
4341 load_path_check (Vload_path);
4342
4343 /* Replace any nil elements from the environment with the default. */
4344 if (Fmemq (Qnil, Vload_path))
4345 {
4346 Lisp_Object lpath = Vload_path;
4347 Lisp_Object elem, default_lpath = load_path_default (1);
4348
4349 /* Check defaults, before adding site-lisp. */
4350 load_path_check (default_lpath);
4351
4352 /* Add the site-lisp directories to the front of the default. */
4353 if (!no_site_lisp)
4354 {
4355 Lisp_Object sitelisp;
4356 sitelisp = decode_env_path (0, PATH_SITELOADSEARCH, 0);
4357 if (! NILP (sitelisp))
4358 default_lpath = nconc2 (sitelisp, default_lpath);
4359 }
4360
4361 Vload_path = Qnil;
4362
4363 /* Replace nils from EMACSLOADPATH by default. */
4364 while (CONSP (lpath))
4365 {
4366 Lisp_Object arg[2];
4367 elem = XCAR (lpath);
4368 lpath = XCDR (lpath);
4369 arg[0] = Vload_path;
4370 arg[1] = NILP (elem) ? default_lpath : Fcons (elem, Qnil);
4371 Vload_path = Fappend (2, arg);
4372 }
4373 } /* Fmemq (Qnil, Vload_path) */
4374 }
4375 else /* Vpurify_flag || !EMACSLOADPATH */
4376 {
4377 Vload_path = load_path_default (0);
4378
4379 /* Check before adding site-lisp directories.
4380 The install should have created them, but they are not
4381 required, so no need to warn if they are absent.
4382 Or we might be running before installation. */
4383 load_path_check (Vload_path);
4384
4385 /* Add the site-lisp directories at the front, unless the
4386 load-path has somehow already been changed (this can only be
4387 from a site-load file during dumping?) from the dumped value.
4388 FIXME? Should we ignore any dump_path changes? */
4389 if (initialized && !no_site_lisp &&
4390 ! NILP (Fequal (dump_path, Vload_path)))
4391 {
4392 Lisp_Object sitelisp;
4393 sitelisp = decode_env_path (0, PATH_SITELOADSEARCH, 0);
4394 if (! NILP (sitelisp)) Vload_path = nconc2 (sitelisp, Vload_path);
4395 }
4396 } /* !Vpurify_flag && EMACSLOADPATH */
4364 4397
4365 Vvalues = Qnil; 4398 Vvalues = Qnil;
4366 4399
@@ -4467,9 +4500,8 @@ were read in. */);
4467 4500
4468 DEFVAR_LISP ("load-path", Vload_path, 4501 DEFVAR_LISP ("load-path", Vload_path,
4469 doc: /* List of directories to search for files to load. 4502 doc: /* List of directories to search for files to load.
4470Each element is a string (directory name) or nil (try default directory). 4503Each element is a string (directory name) or nil (meaning `default-directory').
4471Initialized based on EMACSLOADPATH environment variable, if any, 4504Initialized during startup as described in Info node `(elisp)Library Search'. */);
4472otherwise to default specified by file `epaths.h' when Emacs was built. */);
4473 4505
4474 DEFVAR_LISP ("load-suffixes", Vload_suffixes, 4506 DEFVAR_LISP ("load-suffixes", Vload_suffixes,
4475 doc: /* List of suffixes for (compiled or source) Emacs Lisp files. 4507 doc: /* List of suffixes for (compiled or source) Emacs Lisp files.
@@ -4585,7 +4617,7 @@ and is not meant for users to change. */);
4585You cannot count on them to still be there! */); 4617You cannot count on them to still be there! */);
4586 Vsource_directory 4618 Vsource_directory
4587 = Fexpand_file_name (build_string ("../"), 4619 = Fexpand_file_name (build_string ("../"),
4588 Fcar (decode_env_path (0, PATH_DUMPLOADSEARCH))); 4620 Fcar (decode_env_path (0, PATH_DUMPLOADSEARCH, 0)));
4589 4621
4590 DEFVAR_LISP ("preloaded-file-list", Vpreloaded_file_list, 4622 DEFVAR_LISP ("preloaded-file-list", Vpreloaded_file_list,
4591 doc: /* List of files that were preloaded (when dumping Emacs). */); 4623 doc: /* List of files that were preloaded (when dumping Emacs). */);
diff --git a/test/ChangeLog b/test/ChangeLog
index 84c76c6d83b..59aacd13fd0 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,8 @@
12013-11-23 Glenn Morris <rgm@gnu.org>
2
3 * automated/Makefile.in (emacs):
4 Empty EMACSLOADPATH rather than unsetting.
5
12013-11-22 Glenn Morris <rgm@gnu.org> 62013-11-22 Glenn Morris <rgm@gnu.org>
2 7
3 * automated/ruby-mode-tests.el (ruby-exit!-font-lock): 8 * automated/ruby-mode-tests.el (ruby-exit!-font-lock):
diff --git a/test/automated/Makefile.in b/test/automated/Makefile.in
index a8adaf40483..d187fa607b2 100644
--- a/test/automated/Makefile.in
+++ b/test/automated/Makefile.in
@@ -43,8 +43,7 @@ BYTE_COMPILE_EXTRA_FLAGS =
43 43
44# The actual Emacs command run in the targets below. 44# The actual Emacs command run in the targets below.
45# Prevent any setting of EMACSLOADPATH in user environment causing problems. 45# Prevent any setting of EMACSLOADPATH in user environment causing problems.
46emacs = unset EMACSLOADPATH; \ 46emacs = EMACSLOADPATH= LC_ALL=C EMACS_TEST_DIRECTORY=$(srcdir) "$(EMACS)" $(EMACSOPT)
47 LC_ALL=C EMACS_TEST_DIRECTORY=$(srcdir) "$(EMACS)" $(EMACSOPT)
48 47
49# Common command to find subdirectories 48# Common command to find subdirectories
50setwins=for file in `find $(srcdir) -type d -print`; do \ 49setwins=for file in `find $(srcdir) -type d -print`; do \