diff options
| author | Glenn Morris | 2013-11-22 17:55:16 -0800 |
|---|---|---|
| committer | Glenn Morris | 2013-11-22 17:55:16 -0800 |
| commit | 17e0445be4a6a4f437f4be4924074c90d6477481 (patch) | |
| tree | c78a4df4e1c2f9daf840c96d15dc9e00dd71c68d /src | |
| parent | 72648ef2605b654caf515ef020c2cac70cd0d741 (diff) | |
| download | emacs-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
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 16 | ||||
| -rw-r--r-- | src/callproc.c | 16 | ||||
| -rw-r--r-- | src/emacs.c | 61 | ||||
| -rw-r--r-- | src/image.c | 2 | ||||
| -rw-r--r-- | src/lisp.h | 5 | ||||
| -rw-r--r-- | src/lread.c | 224 |
6 files changed, 189 insertions, 135 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 994ea2d3de5..823a70326bb 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,19 @@ | |||
| 1 | 2013-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 | |||
| 1 | 2013-11-22 Eli Zaretskii <eliz@gnu.org> | 17 | 2013-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. | 3 | Copyright (C) 1985-1988, 1993-1995, 1999-2013 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | This file is part of GNU Emacs. | 5 | This 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 | ||
| 2169 | Lisp_Object | 2169 | Lisp_Object |
| 2170 | decode_env_path (const char *evarname, const char *defalt) | 2170 | decode_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 | ||
| 3 | Copyright (C) 1985-1987, 1993-1995, 1997-2013 Free Software Foundation, | 3 | Copyright (C) 1985-1987, 1993-1995, 1997-2013 Free Software Foundation, Inc. |
| 4 | Inc. | ||
| 5 | 4 | ||
| 6 | This file is part of GNU Emacs. | 5 | This 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) |
| 4059 | extern bool display_arg; | 4058 | extern bool display_arg; |
| 4060 | #endif | 4059 | #endif |
| 4061 | extern Lisp_Object decode_env_path (const char *, const char *); | 4060 | extern Lisp_Object decode_env_path (const char *, const char *, bool); |
| 4062 | extern Lisp_Object empty_unibyte_string, empty_multibyte_string; | 4061 | extern Lisp_Object empty_unibyte_string, empty_multibyte_string; |
| 4063 | extern Lisp_Object Qfile_name_handler_alist; | 4062 | extern Lisp_Object Qfile_name_handler_alist; |
| 4064 | extern _Noreturn void terminate_due_to_signal (int, int); | 4063 | extern _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 | ||
| 3 | Copyright (C) 1985-1989, 1993-1995, 1997-2013 Free Software Foundation, | 3 | Copyright (C) 1985-1989, 1993-1995, 1997-2013 Free Software Foundation, Inc. |
| 4 | Inc. | ||
| 5 | 4 | ||
| 6 | This file is part of GNU Emacs. | 5 | This 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 | ||
| 4111 | static void | 4110 | static void |
| 4112 | load_path_check (void) | 4111 | load_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. */ |
| 4134 | static Lisp_Object dump_path; | 4133 | static 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 | 4169 | Lisp_Object | |
| 4168 | void | 4170 | load_path_default (bool ignore_existing) |
| 4169 | init_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 | |||
| 4330 | void | ||
| 4331 | init_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. |
| 4470 | Each element is a string (directory name) or nil (try default directory). | 4503 | Each element is a string (directory name) or nil (meaning `default-directory'). |
| 4471 | Initialized based on EMACSLOADPATH environment variable, if any, | 4504 | Initialized during startup as described in Info node `(elisp)Library Search'. */); |
| 4472 | otherwise 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. */); | |||
| 4585 | You cannot count on them to still be there! */); | 4617 | You 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). */); |