aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman1997-08-29 19:53:25 +0000
committerRichard M. Stallman1997-08-29 19:53:25 +0000
commit211f7dcdee2710ddb3b22680ab5c6956a0b0ddae (patch)
tree796c605413e4bbbe90b68c0489ae17bdca415470 /src
parent5c5631cf9b0ccff4250cb98cd8fb93bcbae2e716 (diff)
downloademacs-211f7dcdee2710ddb3b22680ab5c6956a0b0ddae.tar.gz
emacs-211f7dcdee2710ddb3b22680ab5c6956a0b0ddae.zip
(Fload): If FILE arg ends in .el or .elc, don't insist on adding a suffix.
Diffstat (limited to 'src')
-rw-r--r--src/lread.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/lread.c b/src/lread.c
index 8718a05c9d4..c065db926fe 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -395,8 +395,9 @@ Print messages at start and end of loading unless\n\
395 optional third arg NOMESSAGE is non-nil.\n\ 395 optional third arg NOMESSAGE is non-nil.\n\
396If optional fourth arg NOSUFFIX is non-nil, don't try adding\n\ 396If optional fourth arg NOSUFFIX is non-nil, don't try adding\n\
397 suffixes `.elc' or `.el' to the specified name FILE.\n\ 397 suffixes `.elc' or `.el' to the specified name FILE.\n\
398If optional fifth arg MUST-SUFFIX is non-nil, insist on adding\n\ 398If optional fifth arg MUST-SUFFIX is non-nil, insist on\n\
399 the suffixe `.elc' or `.el'; don't accept just FILE.\n\ 399 the suffix `.elc' or `.el'; don't accept just FILE unless
400 it ends in one of those suffixes or includes a directory name.\n\
400Return t if file exists.") 401Return t if file exists.")
401 (file, noerror, nomessage, nosuffix, must_suffix) 402 (file, noerror, nomessage, nosuffix, must_suffix)
402 Lisp_Object file, noerror, nomessage, nosuffix, must_suffix; 403 Lisp_Object file, noerror, nomessage, nosuffix, must_suffix;
@@ -433,7 +434,25 @@ Return t if file exists.")
433 since it would try to load a directory as a Lisp file */ 434 since it would try to load a directory as a Lisp file */
434 if (XSTRING (file)->size > 0) 435 if (XSTRING (file)->size > 0)
435 { 436 {
437 int size = XSTRING (file)->size;
438
436 GCPRO1 (file); 439 GCPRO1 (file);
440
441 if (! NILP (must_suffix))
442 {
443 /* Don't insist on adding a suffix if FILE already ends with one. */
444 if (size > 3
445 && !strcmp (XSTRING (file)->data + size - 3, ".el"))
446 must_suffix = Qnil;
447 else if (size > 4
448 && !strcmp (XSTRING (file)->data + size - 4, ".elc"))
449 must_suffix = Qnil;
450 /* Don't insist on adding a suffix
451 if the argument includes a directory name. */
452 else if (! NILP (Ffile_name_directory (file)))
453 must_suffix = Qnil;
454 }
455
437 fd = openp (Vload_path, file, 456 fd = openp (Vload_path, file,
438 (!NILP (nosuffix) ? "" 457 (!NILP (nosuffix) ? ""
439 : ! NILP (must_suffix) ? ".elc:.el" 458 : ! NILP (must_suffix) ? ".elc:.el"