diff options
| author | Kenichi Handa | 2012-01-21 20:36:42 +0900 |
|---|---|---|
| committer | Kenichi Handa | 2012-01-21 20:36:42 +0900 |
| commit | 678fb7066698ebfe3aecba722294025ed26da01b (patch) | |
| tree | 951ac3055141d950974051d13c10e5d7c6a98e31 /src/lread.c | |
| parent | 71784361eb381ec2b12bd8283724a7addec49079 (diff) | |
| parent | 959ad23fb9020a121c4520946835e9f0aeb9bcb2 (diff) | |
| download | emacs-678fb7066698ebfe3aecba722294025ed26da01b.tar.gz emacs-678fb7066698ebfe3aecba722294025ed26da01b.zip | |
merge trunk
Diffstat (limited to 'src/lread.c')
| -rw-r--r-- | src/lread.c | 209 |
1 files changed, 131 insertions, 78 deletions
diff --git a/src/lread.c b/src/lread.c index 7c0b0475786..23cda8eed6d 100644 --- a/src/lread.c +++ b/src/lread.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* Lisp parsing and input streams. | 1 | /* Lisp parsing and input streams. |
| 2 | 2 | ||
| 3 | Copyright (C) 1985-1989, 1993-1995, 1997-2011 Free Software Foundation, Inc. | 3 | Copyright (C) 1985-1989, 1993-1995, 1997-2012 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | This file is part of GNU Emacs. | 5 | This file is part of GNU Emacs. |
| 6 | 6 | ||
| @@ -3113,7 +3113,7 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list) | |||
| 3113 | if (uninterned_symbol && ! NILP (Vpurify_flag)) | 3113 | if (uninterned_symbol && ! NILP (Vpurify_flag)) |
| 3114 | name = make_pure_string (read_buffer, nchars, nbytes, multibyte); | 3114 | name = make_pure_string (read_buffer, nchars, nbytes, multibyte); |
| 3115 | else | 3115 | else |
| 3116 | name = make_specified_string (read_buffer, nchars, nbytes,multibyte); | 3116 | name = make_specified_string (read_buffer, nchars, nbytes, multibyte); |
| 3117 | result = (uninterned_symbol ? Fmake_symbol (name) | 3117 | result = (uninterned_symbol ? Fmake_symbol (name) |
| 3118 | : Fintern (name, Qnil)); | 3118 | : Fintern (name, Qnil)); |
| 3119 | 3119 | ||
| @@ -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,23 +4158,28 @@ 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))) |
| 4130 | { | 4170 | { |
| 4131 | Vload_path = decode_env_path (0, normal); | 4171 | Vload_path = decode_env_path (0, normal); |
| 4132 | if (!NILP (Vinstallation_directory)) | 4172 | if (no_site_lisp || !NILP (Vinstallation_directory)) |
| 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 | { |
| @@ -4151,96 +4195,99 @@ init_lread (void) | |||
| 4151 | break; | 4195 | break; |
| 4152 | } | 4196 | } |
| 4153 | 4197 | ||
| 4154 | /* Add to the path the lisp subdir of the | 4198 | if (!NILP (Vinstallation_directory)) |
| 4155 | installation dir, if it exists. */ | ||
| 4156 | tem = Fexpand_file_name (build_string ("lisp"), | ||
| 4157 | Vinstallation_directory); | ||
| 4158 | tem1 = Ffile_exists_p (tem); | ||
| 4159 | if (!NILP (tem1)) | ||
| 4160 | { | ||
| 4161 | if (NILP (Fmember (tem, Vload_path))) | ||
| 4162 | { | ||
| 4163 | turn_off_warning = 1; | ||
| 4164 | Vload_path = Fcons (tem, Vload_path); | ||
| 4165 | } | ||
| 4166 | } | ||
| 4167 | else | ||
| 4168 | /* That dir doesn't exist, so add the build-time | ||
| 4169 | Lisp dirs instead. */ | ||
| 4170 | Vload_path = nconc2 (Vload_path, dump_path); | ||
| 4171 | |||
| 4172 | /* Add leim under the installation dir, if it exists. */ | ||
| 4173 | tem = Fexpand_file_name (build_string ("leim"), | ||
| 4174 | Vinstallation_directory); | ||
| 4175 | tem1 = Ffile_exists_p (tem); | ||
| 4176 | if (!NILP (tem1)) | ||
| 4177 | { | ||
| 4178 | if (NILP (Fmember (tem, Vload_path))) | ||
| 4179 | Vload_path = Fcons (tem, Vload_path); | ||
| 4180 | } | ||
| 4181 | |||
| 4182 | /* Add site-lisp under the installation dir, if it exists. */ | ||
| 4183 | if (!no_site_lisp) | ||
| 4184 | { | 4199 | { |
| 4185 | tem = Fexpand_file_name (build_string ("site-lisp"), | 4200 | /* Add to the path the lisp subdir of the |
| 4201 | installation dir, if it exists. */ | ||
| 4202 | tem = Fexpand_file_name (build_string ("lisp"), | ||
| 4186 | Vinstallation_directory); | 4203 | Vinstallation_directory); |
| 4187 | tem1 = Ffile_exists_p (tem); | 4204 | tem1 = Ffile_exists_p (tem); |
| 4188 | if (!NILP (tem1)) | 4205 | if (!NILP (tem1)) |
| 4189 | { | 4206 | { |
| 4190 | if (NILP (Fmember (tem, Vload_path))) | 4207 | if (NILP (Fmember (tem, Vload_path))) |
| 4191 | Vload_path = Fcons (tem, Vload_path); | 4208 | { |
| 4209 | turn_off_warning = 1; | ||
| 4210 | Vload_path = Fcons (tem, Vload_path); | ||
| 4211 | } | ||
| 4192 | } | 4212 | } |
| 4193 | } | 4213 | else |
| 4194 | 4214 | /* That dir doesn't exist, so add the build-time | |
| 4195 | /* If Emacs was not built in the source directory, | 4215 | Lisp dirs instead. */ |
| 4196 | and it is run from where it was built, add to load-path | 4216 | Vload_path = nconc2 (Vload_path, dump_path); |
| 4197 | the lisp, leim and site-lisp dirs under that directory. */ | ||
| 4198 | |||
| 4199 | if (NILP (Fequal (Vinstallation_directory, Vsource_directory))) | ||
| 4200 | { | ||
| 4201 | Lisp_Object tem2; | ||
| 4202 | 4217 | ||
| 4203 | tem = Fexpand_file_name (build_string ("src/Makefile"), | 4218 | /* Add leim under the installation dir, if it exists. */ |
| 4219 | tem = Fexpand_file_name (build_string ("leim"), | ||
| 4204 | Vinstallation_directory); | 4220 | Vinstallation_directory); |
| 4205 | tem1 = Ffile_exists_p (tem); | 4221 | tem1 = Ffile_exists_p (tem); |
| 4206 | 4222 | if (!NILP (tem1)) | |
| 4207 | /* Don't be fooled if they moved the entire source tree | ||
| 4208 | AFTER dumping Emacs. If the build directory is indeed | ||
| 4209 | different from the source dir, src/Makefile.in and | ||
| 4210 | src/Makefile will not be found together. */ | ||
| 4211 | tem = Fexpand_file_name (build_string ("src/Makefile.in"), | ||
| 4212 | Vinstallation_directory); | ||
| 4213 | tem2 = Ffile_exists_p (tem); | ||
| 4214 | if (!NILP (tem1) && NILP (tem2)) | ||
| 4215 | { | 4223 | { |
| 4216 | tem = Fexpand_file_name (build_string ("lisp"), | ||
| 4217 | Vsource_directory); | ||
| 4218 | |||
| 4219 | if (NILP (Fmember (tem, Vload_path))) | 4224 | if (NILP (Fmember (tem, Vload_path))) |
| 4220 | Vload_path = Fcons (tem, Vload_path); | 4225 | Vload_path = Fcons (tem, Vload_path); |
| 4226 | } | ||
| 4221 | 4227 | ||
| 4222 | tem = Fexpand_file_name (build_string ("leim"), | 4228 | /* Add site-lisp under the installation dir, if it exists. */ |
| 4223 | Vsource_directory); | 4229 | if (!no_site_lisp) |
| 4230 | { | ||
| 4231 | tem = Fexpand_file_name (build_string ("site-lisp"), | ||
| 4232 | Vinstallation_directory); | ||
| 4233 | tem1 = Ffile_exists_p (tem); | ||
| 4234 | if (!NILP (tem1)) | ||
| 4235 | { | ||
| 4236 | if (NILP (Fmember (tem, Vload_path))) | ||
| 4237 | Vload_path = Fcons (tem, Vload_path); | ||
| 4238 | } | ||
| 4239 | } | ||
| 4224 | 4240 | ||
| 4225 | if (NILP (Fmember (tem, Vload_path))) | 4241 | /* If Emacs was not built in the source directory, |
| 4226 | Vload_path = Fcons (tem, Vload_path); | 4242 | and it is run from where it was built, add to load-path |
| 4243 | the lisp, leim and site-lisp dirs under that directory. */ | ||
| 4227 | 4244 | ||
| 4228 | if (!no_site_lisp) | 4245 | if (NILP (Fequal (Vinstallation_directory, Vsource_directory))) |
| 4246 | { | ||
| 4247 | Lisp_Object tem2; | ||
| 4248 | |||
| 4249 | tem = Fexpand_file_name (build_string ("src/Makefile"), | ||
| 4250 | Vinstallation_directory); | ||
| 4251 | tem1 = Ffile_exists_p (tem); | ||
| 4252 | |||
| 4253 | /* Don't be fooled if they moved the entire source tree | ||
| 4254 | AFTER dumping Emacs. If the build directory is indeed | ||
| 4255 | different from the source dir, src/Makefile.in and | ||
| 4256 | src/Makefile will not be found together. */ | ||
| 4257 | tem = Fexpand_file_name (build_string ("src/Makefile.in"), | ||
| 4258 | Vinstallation_directory); | ||
| 4259 | tem2 = Ffile_exists_p (tem); | ||
| 4260 | if (!NILP (tem1) && NILP (tem2)) | ||
| 4229 | { | 4261 | { |
| 4230 | tem = Fexpand_file_name (build_string ("site-lisp"), | 4262 | tem = Fexpand_file_name (build_string ("lisp"), |
| 4263 | Vsource_directory); | ||
| 4264 | |||
| 4265 | if (NILP (Fmember (tem, Vload_path))) | ||
| 4266 | Vload_path = Fcons (tem, Vload_path); | ||
| 4267 | |||
| 4268 | tem = Fexpand_file_name (build_string ("leim"), | ||
| 4231 | Vsource_directory); | 4269 | Vsource_directory); |
| 4232 | 4270 | ||
| 4233 | if (NILP (Fmember (tem, Vload_path))) | 4271 | if (NILP (Fmember (tem, Vload_path))) |
| 4234 | Vload_path = Fcons (tem, Vload_path); | 4272 | Vload_path = Fcons (tem, Vload_path); |
| 4273 | |||
| 4274 | if (!no_site_lisp) | ||
| 4275 | { | ||
| 4276 | tem = Fexpand_file_name (build_string ("site-lisp"), | ||
| 4277 | Vsource_directory); | ||
| 4278 | |||
| 4279 | if (NILP (Fmember (tem, Vload_path))) | ||
| 4280 | Vload_path = Fcons (tem, Vload_path); | ||
| 4281 | } | ||
| 4235 | } | 4282 | } |
| 4236 | } | 4283 | } /* Vinstallation_directory != Vsource_directory */ |
| 4237 | } | 4284 | } /* if Vinstallation_directory */ |
| 4238 | if (!NILP (sitelisp) && !no_site_lisp) | 4285 | if (!NILP (sitelisp) && !no_site_lisp) |
| 4239 | Vload_path = nconc2 (Fnreverse (sitelisp), Vload_path); | 4286 | Vload_path = nconc2 (Fnreverse (sitelisp), Vload_path); |
| 4240 | } | 4287 | } /* if Vinstallation_directory || no_site_lisp */ |
| 4241 | } | 4288 | } /* if dump_path == Vload_path */ |
| 4242 | } | 4289 | } |
| 4243 | else | 4290 | else /* !initialized */ |
| 4244 | { | 4291 | { |
| 4245 | /* NORMAL refers to the lisp dir in the source directory. */ | 4292 | /* NORMAL refers to the lisp dir in the source directory. */ |
| 4246 | /* We used to add ../lisp at the front here, but | 4293 | /* We used to add ../lisp at the front here, but |
| @@ -4250,7 +4297,7 @@ init_lread (void) | |||
| 4250 | Vload_path = decode_env_path (0, normal); | 4297 | Vload_path = decode_env_path (0, normal); |
| 4251 | dump_path = Vload_path; | 4298 | dump_path = Vload_path; |
| 4252 | } | 4299 | } |
| 4253 | #endif | 4300 | #endif /* CANNOT_DUMP */ |
| 4254 | 4301 | ||
| 4255 | #if (!(defined (WINDOWSNT) || (defined (HAVE_NS)))) | 4302 | #if (!(defined (WINDOWSNT) || (defined (HAVE_NS)))) |
| 4256 | /* When Emacs is invoked over network shares on NT, PATH_LOADSEARCH is | 4303 | /* When Emacs is invoked over network shares on NT, PATH_LOADSEARCH is |
| @@ -4258,6 +4305,8 @@ init_lread (void) | |||
| 4258 | confuses users. Since PATH_LOADSEARCH is always overridden by the | 4305 | confuses users. Since PATH_LOADSEARCH is always overridden by the |
| 4259 | EMACSLOADPATH environment variable below, disable the warning on NT. */ | 4306 | EMACSLOADPATH environment variable below, disable the warning on NT. */ |
| 4260 | 4307 | ||
| 4308 | /* HAVE_NS also uses EMACSLOADPATH. */ | ||
| 4309 | |||
| 4261 | /* Warn if dirs in the *standard* path don't exist. */ | 4310 | /* Warn if dirs in the *standard* path don't exist. */ |
| 4262 | if (!turn_off_warning) | 4311 | if (!turn_off_warning) |
| 4263 | { | 4312 | { |
| @@ -4272,6 +4321,10 @@ init_lread (void) | |||
| 4272 | if (STRINGP (dirfile)) | 4321 | if (STRINGP (dirfile)) |
| 4273 | { | 4322 | { |
| 4274 | dirfile = Fdirectory_file_name (dirfile); | 4323 | dirfile = Fdirectory_file_name (dirfile); |
| 4324 | /* Do we really need to warn about missing site-lisp dirs? | ||
| 4325 | It's true that the installation should have created | ||
| 4326 | them and added subdirs.el, but it's harmless if they | ||
| 4327 | are not there. */ | ||
| 4275 | if (access (SSDATA (dirfile), 0) < 0) | 4328 | if (access (SSDATA (dirfile), 0) < 0) |
| 4276 | dir_warning ("Warning: Lisp directory `%s' does not exist.\n", | 4329 | dir_warning ("Warning: Lisp directory `%s' does not exist.\n", |
| 4277 | XCAR (path_tail)); | 4330 | XCAR (path_tail)); |