diff options
| author | Glenn Morris | 2012-01-10 17:41:09 -0500 |
|---|---|---|
| committer | Glenn Morris | 2012-01-10 17:41:09 -0500 |
| commit | 9d8d07e52782cffe85818593bb043237e6e04a79 (patch) | |
| tree | 3f213ce20be550762b1029d9978ad65ef6b10612 /src | |
| parent | fb7e9e0539eabe1b5135fd793cbba20d87ebc1d2 (diff) | |
| download | emacs-9d8d07e52782cffe85818593bb043237e6e04a79.tar.gz emacs-9d8d07e52782cffe85818593bb043237e6e04a79.zip | |
Comments on init_lread.
Diffstat (limited to 'src')
| -rw-r--r-- | src/lread.c | 76 |
1 files changed, 63 insertions, 13 deletions
diff --git a/src/lread.c b/src/lread.c index 7b5fc91e991..218efd90b36 100644 --- a/src/lread.c +++ b/src/lread.c | |||
| @@ -4109,7 +4109,46 @@ init_lread (void) | |||
| 4109 | const char *normal; | 4109 | const char *normal; |
| 4110 | int turn_off_warning = 0; | 4110 | int turn_off_warning = 0; |
| 4111 | 4111 | ||
| 4112 | /* Compute the default load-path. */ | 4112 | /* Compute the default Vload-path, with the following logic: |
| 4113 | If CANNOT_DUMP just use PATH_LOADSEARCH. | ||
| 4114 | Else if purify-flag (ie dumping) start from PATH_DUMPLOADSEARCH; | ||
| 4115 | otherwise start from PATH_LOADSEARCH. | ||
| 4116 | If !initialized, then just set both Vload_path and dump_path. | ||
| 4117 | If initialized, then if Vload_path != dump_path, do nothing. | ||
| 4118 | (Presumably the load-path has already been changed by something.) | ||
| 4119 | Also do nothing if Vinstallation_directory is nil. | ||
| 4120 | Otherwise: | ||
| 4121 | Remove site-lisp directories from the front of load-path. | ||
| 4122 | Add installation-dir/lisp (if exists and not already a member), | ||
| 4123 | at the front, and turn off warnings about missing directories | ||
| 4124 | (because we are presumably running uninstalled). | ||
| 4125 | If it does not exist, add dump_path at the end instead. | ||
| 4126 | Add installation-dir/leim (if exists and not already a member) | ||
| 4127 | at the front. | ||
| 4128 | Add installation-dir/site-lisp (if !no_site_lisp, and exists | ||
| 4129 | and not already a member) at the front. | ||
| 4130 | If installation-dir != source-dir (ie running an uninstalled, | ||
| 4131 | out-of-tree build) AND install-dir/src/Makefile exists BUT | ||
| 4132 | install-dir/src/Makefile.in does NOT exist (this is a sanity | ||
| 4133 | check), then repeat the above steps for source-dir/lisp, | ||
| 4134 | leim and site-lisp. | ||
| 4135 | Finally, add the previously removed site-lisp directories back | ||
| 4136 | at the front (if !no_site_lisp). | ||
| 4137 | |||
| 4138 | We then warn about any of the load-path elements that do not | ||
| 4139 | exist. The only ones that might not exist are those from | ||
| 4140 | PATH_LOADSEARCH, and perhaps dump_path. | ||
| 4141 | |||
| 4142 | Having done all this, we then throw it all away if purify-flag is | ||
| 4143 | nil (ie, not dumping) and EMACSLOADPATH is set, and just | ||
| 4144 | unconditionally use the latter value instead. | ||
| 4145 | So AFAICS the only net results of all the previous steps will be | ||
| 4146 | possibly to issue some irrelevant warnings. | ||
| 4147 | |||
| 4148 | FIXME? There's a case for saying that if we are running | ||
| 4149 | uninstalled, the eventual installation directories should not yet | ||
| 4150 | be included in load-path. | ||
| 4151 | */ | ||
| 4113 | #ifdef CANNOT_DUMP | 4152 | #ifdef CANNOT_DUMP |
| 4114 | normal = PATH_LOADSEARCH; | 4153 | normal = PATH_LOADSEARCH; |
| 4115 | Vload_path = decode_env_path (0, normal); | 4154 | Vload_path = decode_env_path (0, normal); |
| @@ -4119,11 +4158,12 @@ init_lread (void) | |||
| 4119 | else | 4158 | else |
| 4120 | normal = PATH_DUMPLOADSEARCH; | 4159 | normal = PATH_DUMPLOADSEARCH; |
| 4121 | 4160 | ||
| 4122 | /* In a dumped Emacs, we normally have to reset the value of | 4161 | /* In a dumped Emacs, we normally reset the value of Vload_path using |
| 4123 | Vload_path from PATH_LOADSEARCH, since the value that was dumped | 4162 | PATH_LOADSEARCH, since the value that was dumped uses lisp/ in |
| 4124 | uses ../lisp, instead of the path of the installed elisp | 4163 | the source directory, instead of the path of the installed elisp |
| 4125 | libraries. However, if it appears that Vload_path was changed | 4164 | libraries. However, if it appears that Vload_path has already been |
| 4126 | from the default before dumping, don't override that value. */ | 4165 | changed from the default that was saved before dumping, don't |
| 4166 | change it further. */ | ||
| 4127 | if (initialized) | 4167 | if (initialized) |
| 4128 | { | 4168 | { |
| 4129 | if (! NILP (Fequal (dump_path, Vload_path))) | 4169 | if (! NILP (Fequal (dump_path, Vload_path))) |
| @@ -4133,9 +4173,13 @@ init_lread (void) | |||
| 4133 | { | 4173 | { |
| 4134 | Lisp_Object tem, tem1, sitelisp; | 4174 | Lisp_Object tem, tem1, sitelisp; |
| 4135 | 4175 | ||
| 4136 | /* Remove site-lisp dirs from path temporarily and store | 4176 | /* Remove "site-lisp" dirs from front of path temporarily |
| 4137 | them in sitelisp, then conc them on at the end so | 4177 | and store them in sitelisp, then conc them on at the |
| 4138 | they're always first in path. */ | 4178 | end so they're always first in path. |
| 4179 | Note that this won't work if you used a | ||
| 4180 | --enable-locallisppath element that does not happen | ||
| 4181 | to contain "site-lisp" in its name. | ||
| 4182 | */ | ||
| 4139 | sitelisp = Qnil; | 4183 | sitelisp = Qnil; |
| 4140 | while (1) | 4184 | while (1) |
| 4141 | { | 4185 | { |
| @@ -4237,10 +4281,10 @@ init_lread (void) | |||
| 4237 | } | 4281 | } |
| 4238 | if (!NILP (sitelisp) && !no_site_lisp) | 4282 | if (!NILP (sitelisp) && !no_site_lisp) |
| 4239 | Vload_path = nconc2 (Fnreverse (sitelisp), Vload_path); | 4283 | Vload_path = nconc2 (Fnreverse (sitelisp), Vload_path); |
| 4240 | } | 4284 | } /* if Vinstallation_directory */ |
| 4241 | } | 4285 | } /* if dump_path == Vload_path */ |
| 4242 | } | 4286 | } |
| 4243 | else | 4287 | else /* !initialized */ |
| 4244 | { | 4288 | { |
| 4245 | /* NORMAL refers to the lisp dir in the source directory. */ | 4289 | /* NORMAL refers to the lisp dir in the source directory. */ |
| 4246 | /* We used to add ../lisp at the front here, but | 4290 | /* We used to add ../lisp at the front here, but |
| @@ -4250,7 +4294,7 @@ init_lread (void) | |||
| 4250 | Vload_path = decode_env_path (0, normal); | 4294 | Vload_path = decode_env_path (0, normal); |
| 4251 | dump_path = Vload_path; | 4295 | dump_path = Vload_path; |
| 4252 | } | 4296 | } |
| 4253 | #endif | 4297 | #endif /* CANNOT_DUMP */ |
| 4254 | 4298 | ||
| 4255 | #if (!(defined (WINDOWSNT) || (defined (HAVE_NS)))) | 4299 | #if (!(defined (WINDOWSNT) || (defined (HAVE_NS)))) |
| 4256 | /* When Emacs is invoked over network shares on NT, PATH_LOADSEARCH is | 4300 | /* When Emacs is invoked over network shares on NT, PATH_LOADSEARCH is |
| @@ -4258,6 +4302,8 @@ init_lread (void) | |||
| 4258 | confuses users. Since PATH_LOADSEARCH is always overridden by the | 4302 | confuses users. Since PATH_LOADSEARCH is always overridden by the |
| 4259 | EMACSLOADPATH environment variable below, disable the warning on NT. */ | 4303 | EMACSLOADPATH environment variable below, disable the warning on NT. */ |
| 4260 | 4304 | ||
| 4305 | /* HAVE_NS also uses EMACSLOADPATH. */ | ||
| 4306 | |||
| 4261 | /* Warn if dirs in the *standard* path don't exist. */ | 4307 | /* Warn if dirs in the *standard* path don't exist. */ |
| 4262 | if (!turn_off_warning) | 4308 | if (!turn_off_warning) |
| 4263 | { | 4309 | { |
| @@ -4272,6 +4318,10 @@ init_lread (void) | |||
| 4272 | if (STRINGP (dirfile)) | 4318 | if (STRINGP (dirfile)) |
| 4273 | { | 4319 | { |
| 4274 | dirfile = Fdirectory_file_name (dirfile); | 4320 | dirfile = Fdirectory_file_name (dirfile); |
| 4321 | /* Do we really need to warn about missing site-lisp dirs? | ||
| 4322 | It's true that the installation should have created | ||
| 4323 | them and added subdirs.el, but it's harmless if they | ||
| 4324 | are not there. */ | ||
| 4275 | if (access (SSDATA (dirfile), 0) < 0) | 4325 | if (access (SSDATA (dirfile), 0) < 0) |
| 4276 | dir_warning ("Warning: Lisp directory `%s' does not exist.\n", | 4326 | dir_warning ("Warning: Lisp directory `%s' does not exist.\n", |
| 4277 | XCAR (path_tail)); | 4327 | XCAR (path_tail)); |