diff options
| author | Glenn Morris | 2013-12-13 13:25:30 -0500 |
|---|---|---|
| committer | Glenn Morris | 2013-12-13 13:25:30 -0500 |
| commit | 06a4f1102f40c2cb7ffa035b4f16b9039efaf95b (patch) | |
| tree | c365de8bc1db6dc73f2dc8b50a5b49488220bbd6 | |
| parent | 978a5fdaa35e8945920ab194213715e6f1f0bc20 (diff) | |
| download | emacs-06a4f1102f40c2cb7ffa035b4f16b9039efaf95b.tar.gz emacs-06a4f1102f40c2cb7ffa035b4f16b9039efaf95b.zip | |
Unconditionally reset load-path after dumping
* src/lread.c: (dump_path): Remove.
(load-path-default): Remove `changed' argument.
Do not set dump_path permanently. Simplify.
(init_lread): Simplify.
(syms_of_lread): Remove dump_path.
* lisp/loadup.el (load-path): Warn if site-load or site-init changes it.
No more need to reset it when bootstrapping.
* doc/lispref/internals.texi (Building Emacs):
* doc/lispref/loading.texi (Library Search): Mention that site-load,
site-init cannot change load-path.
* INSTALL: No longer mention load-path and site-init/site-load.
* etc/NEWS: Mention this.
Fixes: debbugs:16107
| -rw-r--r-- | ChangeLog | 4 | ||||
| -rw-r--r-- | INSTALL | 4 | ||||
| -rw-r--r-- | doc/lispref/ChangeLog | 6 | ||||
| -rw-r--r-- | doc/lispref/internals.texi | 5 | ||||
| -rw-r--r-- | doc/lispref/loading.texi | 10 | ||||
| -rw-r--r-- | etc/NEWS | 6 | ||||
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/loadup.el | 28 | ||||
| -rw-r--r-- | src/ChangeLog | 9 | ||||
| -rw-r--r-- | src/lread.c | 216 |
10 files changed, 140 insertions, 153 deletions
| @@ -1,3 +1,7 @@ | |||
| 1 | 2013-12-13 Glenn Morris <rgm@gnu.org> | ||
| 2 | |||
| 3 | * INSTALL: No longer mention load-path and site-init/site-load. | ||
| 4 | |||
| 1 | 2013-12-12 Glenn Morris <rgm@gnu.org> | 5 | 2013-12-12 Glenn Morris <rgm@gnu.org> |
| 2 | 6 | ||
| 3 | * Makefile.in (install-info): Handle missing info/dir. | 7 | * Makefile.in (install-info): Handle missing info/dir. |
| @@ -468,10 +468,6 @@ variable gets by default! Make sure you know what kind of value the | |||
| 468 | variable should have. If you don't pay attention to what you are | 468 | variable should have. If you don't pay attention to what you are |
| 469 | doing, you'll make a mistake. | 469 | doing, you'll make a mistake. |
| 470 | 470 | ||
| 471 | If you set load-path to a different value in site-init.el or | ||
| 472 | site-load.el, Emacs will use *precisely* that value when it starts up | ||
| 473 | again. If you do this, you are on your own! | ||
| 474 | |||
| 475 | The `site-*.el' files are nonexistent in the distribution. You do not | 471 | The `site-*.el' files are nonexistent in the distribution. You do not |
| 476 | need to create them if you have nothing to put in them. | 472 | need to create them if you have nothing to put in them. |
| 477 | 473 | ||
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index 9bdc35a112c..4f5ff0ecf44 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2013-12-13 Glenn Morris <rgm@gnu.org> | ||
| 2 | |||
| 3 | * internals.texi (Building Emacs): | ||
| 4 | * loading.texi (Library Search): Mention that site-load, | ||
| 5 | site-init cannot change load-path. | ||
| 6 | |||
| 1 | 2013-12-12 Glenn Morris <rgm@gnu.org> | 7 | 2013-12-12 Glenn Morris <rgm@gnu.org> |
| 2 | 8 | ||
| 3 | * elisp.texi: Tweak dircategory. | 9 | * elisp.texi: Tweak dircategory. |
diff --git a/doc/lispref/internals.texi b/doc/lispref/internals.texi index 06375c1e18e..8cbf3c4e14c 100644 --- a/doc/lispref/internals.texi +++ b/doc/lispref/internals.texi | |||
| @@ -116,6 +116,11 @@ time.) | |||
| 116 | expect in an ordinary unmodified Emacs. If you feel you must override | 116 | expect in an ordinary unmodified Emacs. If you feel you must override |
| 117 | normal features for your site, do it with @file{default.el}, so that | 117 | normal features for your site, do it with @file{default.el}, so that |
| 118 | users can override your changes if they wish. @xref{Startup Summary}. | 118 | users can override your changes if they wish. @xref{Startup Summary}. |
| 119 | Note that if either @file{site-load.el} or @file{site-init.el} changes | ||
| 120 | @code{load-path}, the changes will be lost after dumping. | ||
| 121 | @xref{Library Search}. To make a permanent change to | ||
| 122 | @code{load-path}, use the @option{--enable-locallisppath} option | ||
| 123 | of @command{configure}. | ||
| 119 | 124 | ||
| 120 | In a package that can be preloaded, it is sometimes necessary (or | 125 | In a package that can be preloaded, it is sometimes necessary (or |
| 121 | useful) to delay certain evaluations until Emacs subsequently starts | 126 | useful) to delay certain evaluations until Emacs subsequently starts |
diff --git a/doc/lispref/loading.texi b/doc/lispref/loading.texi index 0505b67961d..48866a10687 100644 --- a/doc/lispref/loading.texi +++ b/doc/lispref/loading.texi | |||
| @@ -361,12 +361,10 @@ add one or more directories to @code{load-path}. For example: | |||
| 361 | (push "~/.emacs.d/lisp" load-path) | 361 | (push "~/.emacs.d/lisp" load-path) |
| 362 | @end example | 362 | @end example |
| 363 | 363 | ||
| 364 | Dumping Emacs uses a special value of @code{load-path}. If the | 364 | Dumping Emacs uses a special value of @code{load-path}. If you use |
| 365 | value of @code{load-path} at the end of dumping is unchanged (that is, | 365 | a @file{site-load.el} or @file{site-init.el} file to customize the |
| 366 | still the same special value), the dumped Emacs switches to the | 366 | dumped Emacs (@pxref{Building Emacs}), any changes to @code{load-path} |
| 367 | ordinary @code{load-path} value when it starts up, as described above. | 367 | that these files make will be lost after dumping. |
| 368 | But if @code{load-path} has any other value at the end of dumping, | ||
| 369 | that value is used for execution of the dumped Emacs also. | ||
| 370 | 368 | ||
| 371 | @deffn Command locate-library library &optional nosuffix path interactive-call | 369 | @deffn Command locate-library library &optional nosuffix path interactive-call |
| 372 | This command finds the precise file name for library @var{library}. It | 370 | This command finds the precise file name for library @var{library}. It |
| @@ -77,6 +77,12 @@ was replaced by ".", so use an explicit "." now if that is what you want.) | |||
| 77 | will instead append, if the argument begins with `:' (or `;' on MS Windows; | 77 | will instead append, if the argument begins with `:' (or `;' on MS Windows; |
| 78 | i.e., `path-separator'). | 78 | i.e., `path-separator'). |
| 79 | 79 | ||
| 80 | +++ | ||
| 81 | ** If you use either site-load.el or site-init.el to customize the dumped | ||
| 82 | Emacs executable, any changes to `load-path' that these files make | ||
| 83 | will no longer be present after dumping. To affect a permanent change | ||
| 84 | to `load-path', use the `--enable-locallisppath' option of `configure'. | ||
| 85 | |||
| 80 | 86 | ||
| 81 | * Changes in Emacs 24.4 | 87 | * Changes in Emacs 24.4 |
| 82 | 88 | ||
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 8bd026470d1..8dd26cf294e 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2013-12-13 Glenn Morris <rgm@gnu.org> | ||
| 2 | |||
| 3 | * loadup.el (load-path): Warn if site-load or site-init changes it. | ||
| 4 | No more need to reset it when bootstrapping. | ||
| 5 | |||
| 1 | 2013-12-13 Teodor Zlatanov <tzz@lifelogs.com> | 6 | 2013-12-13 Teodor Zlatanov <tzz@lifelogs.com> |
| 2 | 7 | ||
| 3 | * progmodes/cfengine.el (cfengine-cf-promises): Add more default | 8 | * progmodes/cfengine.el (cfengine-cf-promises): Add more default |
diff --git a/lisp/loadup.el b/lisp/loadup.el index b72ddc0955b..520fe4e701e 100644 --- a/lisp/loadup.el +++ b/lisp/loadup.el | |||
| @@ -46,9 +46,6 @@ | |||
| 46 | ;; Add subdirectories to the load-path for files that might get | 46 | ;; Add subdirectories to the load-path for files that might get |
| 47 | ;; autoloaded when bootstrapping. | 47 | ;; autoloaded when bootstrapping. |
| 48 | ;; This is because PATH_DUMPLOADSEARCH is just "../lisp". | 48 | ;; This is because PATH_DUMPLOADSEARCH is just "../lisp". |
| 49 | ;; Note that we reset load-path below just before dumping, | ||
| 50 | ;; since lread.c:init_lread checks for changes to load-path | ||
| 51 | ;; in deciding whether to modify it. | ||
| 52 | (if (or (equal (nth 3 command-line-args) "bootstrap") | 49 | (if (or (equal (nth 3 command-line-args) "bootstrap") |
| 53 | (equal (nth 4 command-line-args) "bootstrap") | 50 | (equal (nth 4 command-line-args) "bootstrap") |
| 54 | ;; FIXME this is irritatingly fragile. | 51 | ;; FIXME this is irritatingly fragile. |
| @@ -293,8 +290,15 @@ | |||
| 293 | ;; you may load them with a "site-load.el" file. | 290 | ;; you may load them with a "site-load.el" file. |
| 294 | ;; But you must also cause them to be scanned when the DOC file | 291 | ;; But you must also cause them to be scanned when the DOC file |
| 295 | ;; is generated. | 292 | ;; is generated. |
| 296 | ;; For other systems, you must edit ../src/Makefile.in. | 293 | (let ((lp load-path)) |
| 297 | (load "site-load" t) | 294 | (load "site-load" t) |
| 295 | ;; We reset load-path after dumping. | ||
| 296 | ;; For a permanent change in load-path, use configure's | ||
| 297 | ;; --enable-locallisppath option. | ||
| 298 | ;; See http://debbugs.gnu.org/16107 for more details. | ||
| 299 | (or (equal lp load-path) | ||
| 300 | (message "Warning: Change in load-path due to site-load will be \ | ||
| 301 | lost after dumping"))) | ||
| 298 | 302 | ||
| 299 | ;; Make sure default-directory is unibyte when dumping. This is | 303 | ;; Make sure default-directory is unibyte when dumping. This is |
| 300 | ;; because we cannot decode and encode it correctly (since the locale | 304 | ;; because we cannot decode and encode it correctly (since the locale |
| @@ -342,8 +346,13 @@ | |||
| 342 | 346 | ||
| 343 | ;; Note: You can cause additional libraries to be preloaded | 347 | ;; Note: You can cause additional libraries to be preloaded |
| 344 | ;; by writing a site-init.el that loads them. | 348 | ;; by writing a site-init.el that loads them. |
| 345 | ;; See also "site-load" above. | 349 | ;; See also "site-load" above |
| 346 | (load "site-init" t) | 350 | (let ((lp load-path)) |
| 351 | (load "site-init" t) | ||
| 352 | (or (equal lp load-path) | ||
| 353 | (message "Warning: Change in load-path due to site-init will be \ | ||
| 354 | lost after dumping"))) | ||
| 355 | |||
| 347 | (setq current-load-list nil) | 356 | (setq current-load-list nil) |
| 348 | 357 | ||
| 349 | ;; We keep the load-history data in PURE space. | 358 | ;; We keep the load-history data in PURE space. |
| @@ -353,11 +362,6 @@ | |||
| 353 | 362 | ||
| 354 | (set-buffer-modified-p nil) | 363 | (set-buffer-modified-p nil) |
| 355 | 364 | ||
| 356 | ;; reset the load-path. See lread.c:init_lread why. | ||
| 357 | (if (or (equal (nth 3 command-line-args) "bootstrap") | ||
| 358 | (equal (nth 4 command-line-args) "bootstrap")) | ||
| 359 | (setcdr load-path nil)) | ||
| 360 | |||
| 361 | (remove-hook 'after-load-functions (lambda (f) (garbage-collect))) | 365 | (remove-hook 'after-load-functions (lambda (f) (garbage-collect))) |
| 362 | 366 | ||
| 363 | (setq inhibit-load-charset-map nil) | 367 | (setq inhibit-load-charset-map nil) |
diff --git a/src/ChangeLog b/src/ChangeLog index 4e8285e9530..0b0ed9452ee 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,12 @@ | |||
| 1 | 2013-12-13 Glenn Morris <rgm@gnu.org> | ||
| 2 | |||
| 3 | * lread.c: Unconditionally reset load-path after dumping. (Bug#16107) | ||
| 4 | (dump_path): Remove. | ||
| 5 | (load-path-default): Remove `changed' argument. | ||
| 6 | Do not set dump_path permanently. Simplify. | ||
| 7 | (init_lread): Simplify. | ||
| 8 | (syms_of_lread): Remove dump_path. | ||
| 9 | |||
| 1 | 2013-12-13 Dmitry Antipov <dmantipov@yandex.ru> | 10 | 2013-12-13 Dmitry Antipov <dmantipov@yandex.ru> |
| 2 | 11 | ||
| 3 | * alloc.c, font.c, font.h, ftfont.c, ftxfont.c, macfont.m, | 12 | * alloc.c, font.c, font.h, ftfont.c, ftxfont.c, macfont.m, |
diff --git a/src/lread.c b/src/lread.c index a64f083a5ac..5d02b2bd20b 100644 --- a/src/lread.c +++ b/src/lread.c | |||
| @@ -4128,10 +4128,6 @@ load_path_check (Lisp_Object lpath) | |||
| 4128 | } | 4128 | } |
| 4129 | } | 4129 | } |
| 4130 | 4130 | ||
| 4131 | /* Record the value of load-path used at the start of dumping | ||
| 4132 | so we can see if the site changed it later during dumping. */ | ||
| 4133 | static Lisp_Object dump_path; | ||
| 4134 | |||
| 4135 | /* Return the default load-path, to be used if EMACSLOADPATH is unset. | 4131 | /* Return the default load-path, to be used if EMACSLOADPATH is unset. |
| 4136 | This does not include the standard site-lisp directories | 4132 | This does not include the standard site-lisp directories |
| 4137 | under the installation prefix (i.e., PATH_SITELOADSEARCH), | 4133 | under the installation prefix (i.e., PATH_SITELOADSEARCH), |
| @@ -4145,18 +4141,16 @@ static Lisp_Object dump_path; | |||
| 4145 | If purify-flag (ie dumping) just use PATH_DUMPLOADSEARCH. | 4141 | If purify-flag (ie dumping) just use PATH_DUMPLOADSEARCH. |
| 4146 | Otherwise use PATH_LOADSEARCH. | 4142 | Otherwise use PATH_LOADSEARCH. |
| 4147 | 4143 | ||
| 4148 | If !initialized, then just set dump_path and return PATH_DUMPLOADSEARCH. | 4144 | If !initialized, then just return PATH_DUMPLOADSEARCH. |
| 4149 | If initialized, then if Vload_path != dump_path, return just Vload_path. | 4145 | If initialized: |
| 4150 | (Presumably the load-path has already been changed by something. | ||
| 4151 | This can only be from a site-load file during dumping.) | ||
| 4152 | If Vinstallation_directory is not nil (ie, running uninstalled): | 4146 | If Vinstallation_directory is not nil (ie, running uninstalled): |
| 4153 | If installation-dir/lisp exists and not already a member, | 4147 | If installation-dir/lisp exists and not already a member, |
| 4154 | we must be running uninstalled. Reset the load-path | 4148 | we must be running uninstalled. Reset the load-path |
| 4155 | to just installation-dir/lisp. (The default PATH_LOADSEARCH | 4149 | to just installation-dir/lisp. (The default PATH_LOADSEARCH |
| 4156 | refers to the eventual installation directories. Since we | 4150 | refers to the eventual installation directories. Since we |
| 4157 | are not yet installed, we should not use them, even if they exist.) | 4151 | are not yet installed, we should not use them, even if they exist.) |
| 4158 | If installation-dir/lisp does not exist, just add dump_path at the | 4152 | If installation-dir/lisp does not exist, just add |
| 4159 | end instead. | 4153 | PATH_DUMPLOADSEARCH at the end instead. |
| 4160 | Add installation-dir/site-lisp (if !no_site_lisp, and exists | 4154 | Add installation-dir/site-lisp (if !no_site_lisp, and exists |
| 4161 | and not already a member) at the front. | 4155 | and not already a member) at the front. |
| 4162 | If installation-dir != source-dir (ie running an uninstalled, | 4156 | If installation-dir != source-dir (ie running an uninstalled, |
| @@ -4165,7 +4159,7 @@ static Lisp_Object dump_path; | |||
| 4165 | check), then repeat the above steps for source-dir/lisp, site-lisp. */ | 4159 | check), then repeat the above steps for source-dir/lisp, site-lisp. */ |
| 4166 | 4160 | ||
| 4167 | static Lisp_Object | 4161 | static Lisp_Object |
| 4168 | load_path_default (bool changed) | 4162 | load_path_default () |
| 4169 | { | 4163 | { |
| 4170 | Lisp_Object lpath = Qnil; | 4164 | Lisp_Object lpath = Qnil; |
| 4171 | const char *normal; | 4165 | const char *normal; |
| @@ -4186,131 +4180,108 @@ load_path_default (bool changed) | |||
| 4186 | 4180 | ||
| 4187 | normal = NILP (Vpurify_flag) ? PATH_LOADSEARCH : PATH_DUMPLOADSEARCH; | 4181 | normal = NILP (Vpurify_flag) ? PATH_LOADSEARCH : PATH_DUMPLOADSEARCH; |
| 4188 | 4182 | ||
| 4189 | /* In a dumped Emacs, we normally reset the value of Vload_path using | ||
| 4190 | PATH_LOADSEARCH, since the value that was dumped uses lisp/ in | ||
| 4191 | the source directory, instead of the path of the installed elisp | ||
| 4192 | libraries. However, if it appears that Vload_path has already been | ||
| 4193 | changed from the default that was saved before dumping, don't | ||
| 4194 | change it further. Changes can only be due to site-lisp | ||
| 4195 | files that were processed during dumping. */ | ||
| 4196 | /* FIXME? AFAICS, it does not make sense to change load-path in a | ||
| 4197 | dumped site-lisp file, so maybe we should just drop this check. | ||
| 4198 | E.g., if you add an element to load-path, you are going to be | ||
| 4199 | adding it to PATH_DUMPLOADSEARCH, which refers to the source directory. | ||
| 4200 | This will make no sense (and may not still exist) in an installed Emacs. | ||
| 4201 | And the only change it is sensible to make to load-path is to add | ||
| 4202 | something to the front, which you should do with configure's | ||
| 4203 | --enable-locallisppath option if you really want to have it dumped. */ | ||
| 4204 | if (initialized) | 4183 | if (initialized) |
| 4205 | { | 4184 | { |
| 4206 | if (changed || NILP (Fequal (dump_path, Vload_path))) | ||
| 4207 | { | ||
| 4208 | /* Do not make any changes. */ | ||
| 4209 | return Vload_path; | ||
| 4210 | } | ||
| 4211 | else | ||
| 4212 | { | ||
| 4213 | #ifdef HAVE_NS | 4185 | #ifdef HAVE_NS |
| 4214 | const char *loadpath = ns_load_path (); | 4186 | const char *loadpath = ns_load_path (); |
| 4215 | lpath = decode_env_path (0, loadpath ? loadpath : normal, 0); | 4187 | lpath = decode_env_path (0, loadpath ? loadpath : normal, 0); |
| 4216 | #else | 4188 | #else |
| 4217 | lpath = decode_env_path (0, normal, 0); | 4189 | lpath = decode_env_path (0, normal, 0); |
| 4218 | #endif | 4190 | #endif |
| 4219 | if (!NILP (Vinstallation_directory)) | 4191 | if (!NILP (Vinstallation_directory)) |
| 4192 | { | ||
| 4193 | Lisp_Object tem, tem1; | ||
| 4194 | |||
| 4195 | /* Add to the path the lisp subdir of the installation | ||
| 4196 | dir, if it is accessible. Note: in out-of-tree builds, | ||
| 4197 | this directory is empty save for Makefile. */ | ||
| 4198 | tem = Fexpand_file_name (build_string ("lisp"), | ||
| 4199 | Vinstallation_directory); | ||
| 4200 | tem1 = Ffile_accessible_directory_p (tem); | ||
| 4201 | if (!NILP (tem1)) | ||
| 4202 | { | ||
| 4203 | if (NILP (Fmember (tem, lpath))) | ||
| 4204 | { | ||
| 4205 | /* We are running uninstalled. The default load-path | ||
| 4206 | points to the eventual installed lisp directories. | ||
| 4207 | We should not use those now, even if they exist, | ||
| 4208 | so start over from a clean slate. */ | ||
| 4209 | lpath = list1 (tem); | ||
| 4210 | } | ||
| 4211 | } | ||
| 4212 | else | ||
| 4213 | /* That dir doesn't exist, so add the build-time | ||
| 4214 | Lisp dirs instead. */ | ||
| 4220 | { | 4215 | { |
| 4221 | Lisp_Object tem, tem1; | 4216 | Lisp_Object dump_path = |
| 4217 | decode_env_path (0, PATH_DUMPLOADSEARCH, 0); | ||
| 4218 | lpath = nconc2 (lpath, dump_path); | ||
| 4219 | } | ||
| 4222 | 4220 | ||
| 4223 | /* Add to the path the lisp subdir of the installation | 4221 | /* Add site-lisp under the installation dir, if it exists. */ |
| 4224 | dir, if it is accessible. Note: in out-of-tree builds, | 4222 | if (!no_site_lisp) |
| 4225 | this directory is empty save for Makefile. */ | 4223 | { |
| 4226 | tem = Fexpand_file_name (build_string ("lisp"), | 4224 | tem = Fexpand_file_name (build_string ("site-lisp"), |
| 4227 | Vinstallation_directory); | 4225 | Vinstallation_directory); |
| 4228 | tem1 = Ffile_accessible_directory_p (tem); | 4226 | tem1 = Ffile_accessible_directory_p (tem); |
| 4229 | if (!NILP (tem1)) | 4227 | if (!NILP (tem1)) |
| 4230 | { | 4228 | { |
| 4231 | if (NILP (Fmember (tem, lpath))) | 4229 | if (NILP (Fmember (tem, lpath))) |
| 4232 | { | 4230 | lpath = Fcons (tem, lpath); |
| 4233 | /* We are running uninstalled. The default load-path | ||
| 4234 | points to the eventual installed lisp directories. | ||
| 4235 | We should not use those now, even if they exist, | ||
| 4236 | so start over from a clean slate. */ | ||
| 4237 | lpath = list1 (tem); | ||
| 4238 | } | ||
| 4239 | } | 4231 | } |
| 4240 | else | 4232 | } |
| 4241 | /* That dir doesn't exist, so add the build-time | ||
| 4242 | Lisp dirs instead. */ | ||
| 4243 | lpath = nconc2 (lpath, dump_path); | ||
| 4244 | 4233 | ||
| 4245 | /* Add site-lisp under the installation dir, if it exists. */ | 4234 | /* If Emacs was not built in the source directory, |
| 4246 | if (!no_site_lisp) | 4235 | and it is run from where it was built, add to load-path |
| 4247 | { | 4236 | the lisp and site-lisp dirs under that directory. */ |
| 4248 | tem = Fexpand_file_name (build_string ("site-lisp"), | ||
| 4249 | Vinstallation_directory); | ||
| 4250 | tem1 = Ffile_accessible_directory_p (tem); | ||
| 4251 | if (!NILP (tem1)) | ||
| 4252 | { | ||
| 4253 | if (NILP (Fmember (tem, lpath))) | ||
| 4254 | lpath = Fcons (tem, lpath); | ||
| 4255 | } | ||
| 4256 | } | ||
| 4257 | 4237 | ||
| 4258 | /* If Emacs was not built in the source directory, | 4238 | if (NILP (Fequal (Vinstallation_directory, Vsource_directory))) |
| 4259 | and it is run from where it was built, add to load-path | 4239 | { |
| 4260 | the lisp and site-lisp dirs under that directory. */ | 4240 | Lisp_Object tem2; |
| 4241 | |||
| 4242 | tem = Fexpand_file_name (build_string ("src/Makefile"), | ||
| 4243 | Vinstallation_directory); | ||
| 4244 | tem1 = Ffile_exists_p (tem); | ||
| 4261 | 4245 | ||
| 4262 | if (NILP (Fequal (Vinstallation_directory, Vsource_directory))) | 4246 | /* Don't be fooled if they moved the entire source tree |
| 4247 | AFTER dumping Emacs. If the build directory is indeed | ||
| 4248 | different from the source dir, src/Makefile.in and | ||
| 4249 | src/Makefile will not be found together. */ | ||
| 4250 | tem = Fexpand_file_name (build_string ("src/Makefile.in"), | ||
| 4251 | Vinstallation_directory); | ||
| 4252 | tem2 = Ffile_exists_p (tem); | ||
| 4253 | if (!NILP (tem1) && NILP (tem2)) | ||
| 4263 | { | 4254 | { |
| 4264 | Lisp_Object tem2; | 4255 | tem = Fexpand_file_name (build_string ("lisp"), |
| 4265 | 4256 | Vsource_directory); | |
| 4266 | tem = Fexpand_file_name (build_string ("src/Makefile"), | ||
| 4267 | Vinstallation_directory); | ||
| 4268 | tem1 = Ffile_exists_p (tem); | ||
| 4269 | |||
| 4270 | /* Don't be fooled if they moved the entire source tree | ||
| 4271 | AFTER dumping Emacs. If the build directory is indeed | ||
| 4272 | different from the source dir, src/Makefile.in and | ||
| 4273 | src/Makefile will not be found together. */ | ||
| 4274 | tem = Fexpand_file_name (build_string ("src/Makefile.in"), | ||
| 4275 | Vinstallation_directory); | ||
| 4276 | tem2 = Ffile_exists_p (tem); | ||
| 4277 | if (!NILP (tem1) && NILP (tem2)) | ||
| 4278 | { | ||
| 4279 | tem = Fexpand_file_name (build_string ("lisp"), | ||
| 4280 | Vsource_directory); | ||
| 4281 | 4257 | ||
| 4282 | if (NILP (Fmember (tem, lpath))) | 4258 | if (NILP (Fmember (tem, lpath))) |
| 4283 | lpath = Fcons (tem, lpath); | 4259 | lpath = Fcons (tem, lpath); |
| 4284 | 4260 | ||
| 4285 | if (!no_site_lisp) | 4261 | if (!no_site_lisp) |
| 4262 | { | ||
| 4263 | tem = Fexpand_file_name (build_string ("site-lisp"), | ||
| 4264 | Vsource_directory); | ||
| 4265 | tem1 = Ffile_accessible_directory_p (tem); | ||
| 4266 | if (!NILP (tem1)) | ||
| 4286 | { | 4267 | { |
| 4287 | tem = Fexpand_file_name (build_string ("site-lisp"), | 4268 | if (NILP (Fmember (tem, lpath))) |
| 4288 | Vsource_directory); | 4269 | lpath = Fcons (tem, lpath); |
| 4289 | tem1 = Ffile_accessible_directory_p (tem); | ||
| 4290 | if (!NILP (tem1)) | ||
| 4291 | { | ||
| 4292 | if (NILP (Fmember (tem, lpath))) | ||
| 4293 | lpath = Fcons (tem, lpath); | ||
| 4294 | } | ||
| 4295 | } | 4270 | } |
| 4296 | } | 4271 | } |
| 4297 | } /* Vinstallation_directory != Vsource_directory */ | 4272 | } |
| 4298 | 4273 | } /* Vinstallation_directory != Vsource_directory */ | |
| 4299 | } /* if Vinstallation_directory */ | ||
| 4300 | 4274 | ||
| 4301 | } /* if dump_path == Vload_path */ | 4275 | } /* if Vinstallation_directory */ |
| 4302 | } | 4276 | } |
| 4303 | else /* !initialized */ | 4277 | else /* !initialized */ |
| 4304 | { | 4278 | { |
| 4305 | /* NORMAL refers to PATH_DUMPLOADSEARCH, ie the lisp dir in the | 4279 | /* NORMAL refers to PATH_DUMPLOADSEARCH, ie the lisp dir in the |
| 4306 | source directory. We used to add ../lisp (ie the lisp dir in | 4280 | source directory. We used to add ../lisp (ie the lisp dir in |
| 4307 | the build directory) at the front here, but that caused trouble | 4281 | the build directory) at the front here, but that should not |
| 4308 | because it was copied from dump_path into Vload_path, above, | 4282 | be necessary, since in out of tree builds lisp/ is empty, save |
| 4309 | when Vinstallation_directory was non-nil. It should not be | ||
| 4310 | necessary, since in out of tree builds lisp/ is empty, save | ||
| 4311 | for Makefile. */ | 4283 | for Makefile. */ |
| 4312 | lpath = decode_env_path (0, normal, 0); | 4284 | lpath = decode_env_path (0, normal, 0); |
| 4313 | dump_path = lpath; | ||
| 4314 | } | 4285 | } |
| 4315 | #endif /* !CANNOT_DUMP */ | 4286 | #endif /* !CANNOT_DUMP */ |
| 4316 | 4287 | ||
| @@ -4322,27 +4293,20 @@ init_lread (void) | |||
| 4322 | { | 4293 | { |
| 4323 | /* First, set Vload_path. */ | 4294 | /* First, set Vload_path. */ |
| 4324 | 4295 | ||
| 4325 | /* NB: Do not change Vload_path before calling load_path_default, | ||
| 4326 | since it may check it against dump_path. | ||
| 4327 | (This behavior could be changed.) */ | ||
| 4328 | |||
| 4329 | /* We explicitly ignore EMACSLOADPATH when dumping. */ | 4296 | /* We explicitly ignore EMACSLOADPATH when dumping. */ |
| 4330 | if (NILP (Vpurify_flag) && egetenv ("EMACSLOADPATH")) | 4297 | if (NILP (Vpurify_flag) && egetenv ("EMACSLOADPATH")) |
| 4331 | { | 4298 | { |
| 4332 | Lisp_Object elpath = decode_env_path ("EMACSLOADPATH", 0, 1); | 4299 | Vload_path = decode_env_path ("EMACSLOADPATH", 0, 1); |
| 4333 | 4300 | ||
| 4334 | /* Check (non-nil) user-supplied elements. */ | 4301 | /* Check (non-nil) user-supplied elements. */ |
| 4335 | load_path_check (elpath); | 4302 | load_path_check (Vload_path); |
| 4336 | 4303 | ||
| 4337 | /* If no nils in the environment variable, use as-is. | 4304 | /* If no nils in the environment variable, use as-is. |
| 4338 | Otherwise, replace any nils with the default. */ | 4305 | Otherwise, replace any nils with the default. */ |
| 4339 | if (NILP (Fmemq (Qnil, elpath))) | 4306 | if (! NILP (Fmemq (Qnil, Vload_path))) |
| 4340 | { | ||
| 4341 | Vload_path = elpath; | ||
| 4342 | } | ||
| 4343 | else | ||
| 4344 | { | 4307 | { |
| 4345 | Lisp_Object elem, default_lpath = load_path_default (0); | 4308 | Lisp_Object elem, elpath = Vload_path; |
| 4309 | Lisp_Object default_lpath = load_path_default (); | ||
| 4346 | 4310 | ||
| 4347 | /* Check defaults, before adding site-lisp. */ | 4311 | /* Check defaults, before adding site-lisp. */ |
| 4348 | load_path_check (default_lpath); | 4312 | load_path_check (default_lpath); |
| @@ -4372,13 +4336,7 @@ init_lread (void) | |||
| 4372 | } | 4336 | } |
| 4373 | else /* Vpurify_flag || !EMACSLOADPATH */ | 4337 | else /* Vpurify_flag || !EMACSLOADPATH */ |
| 4374 | { | 4338 | { |
| 4375 | #ifdef CANNOT_DUMP | 4339 | Vload_path = load_path_default (); |
| 4376 | bool changed = 0; | ||
| 4377 | #else | ||
| 4378 | bool changed = initialized && NILP (Fequal (dump_path, Vload_path)); | ||
| 4379 | #endif | ||
| 4380 | |||
| 4381 | Vload_path = load_path_default (changed); | ||
| 4382 | 4340 | ||
| 4383 | /* Check before adding site-lisp directories. | 4341 | /* Check before adding site-lisp directories. |
| 4384 | The install should have created them, but they are not | 4342 | The install should have created them, but they are not |
| @@ -4386,10 +4344,8 @@ init_lread (void) | |||
| 4386 | Or we might be running before installation. */ | 4344 | Or we might be running before installation. */ |
| 4387 | load_path_check (Vload_path); | 4345 | load_path_check (Vload_path); |
| 4388 | 4346 | ||
| 4389 | /* Add the site-lisp directories at the front, unless the | 4347 | /* Add the site-lisp directories at the front. */ |
| 4390 | load-path has already been changed. | 4348 | if (initialized && !no_site_lisp) |
| 4391 | FIXME? Should we ignore changed here? */ | ||
| 4392 | if (initialized && !no_site_lisp && !changed) | ||
| 4393 | { | 4349 | { |
| 4394 | Lisp_Object sitelisp; | 4350 | Lisp_Object sitelisp; |
| 4395 | sitelisp = decode_env_path (0, PATH_SITELOADSEARCH, 0); | 4351 | sitelisp = decode_env_path (0, PATH_SITELOADSEARCH, 0); |
| @@ -4694,8 +4650,6 @@ variables, this must be set in the first line of a file. */); | |||
| 4694 | DEFSYM (Qdir_ok, "dir-ok"); | 4650 | DEFSYM (Qdir_ok, "dir-ok"); |
| 4695 | DEFSYM (Qdo_after_load_evaluation, "do-after-load-evaluation"); | 4651 | DEFSYM (Qdo_after_load_evaluation, "do-after-load-evaluation"); |
| 4696 | 4652 | ||
| 4697 | staticpro (&dump_path); | ||
| 4698 | |||
| 4699 | staticpro (&read_objects); | 4653 | staticpro (&read_objects); |
| 4700 | read_objects = Qnil; | 4654 | read_objects = Qnil; |
| 4701 | staticpro (&seen_list); | 4655 | staticpro (&seen_list); |