Mercurial > emacs
comparison src/lread.c @ 19115:266915689f9e
(Fload): New optional arg MUST-SUFFIX.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Mon, 04 Aug 1997 03:00:11 +0000 |
parents | 1ee295d0114a |
children | c962562027d4 |
comparison
equal
deleted
inserted
replaced
19114:5e2c2c7ca25e | 19115:266915689f9e |
---|---|
382 | 382 |
383 static void readevalloop (); | 383 static void readevalloop (); |
384 static Lisp_Object load_unwind (); | 384 static Lisp_Object load_unwind (); |
385 static Lisp_Object load_descriptor_unwind (); | 385 static Lisp_Object load_descriptor_unwind (); |
386 | 386 |
387 DEFUN ("load", Fload, Sload, 1, 4, 0, | 387 DEFUN ("load", Fload, Sload, 1, 5, 0, |
388 "Execute a file of Lisp code named FILE.\n\ | 388 "Execute a file of Lisp code named FILE.\n\ |
389 First try FILE with `.elc' appended, then try with `.el',\n\ | 389 First try FILE with `.elc' appended, then try with `.el',\n\ |
390 then try FILE unmodified.\n\ | 390 then try FILE unmodified.\n\ |
391 This function searches the directories in `load-path'.\n\ | 391 This function searches the directories in `load-path'.\n\ |
392 If optional second arg NOERROR is non-nil,\n\ | 392 If optional second arg NOERROR is non-nil,\n\ |
393 report no error if FILE doesn't exist.\n\ | 393 report no error if FILE doesn't exist.\n\ |
394 Print messages at start and end of loading unless\n\ | 394 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\ |
396 If optional fourth arg NOSUFFIX is non-nil, don't try adding\n\ | 396 If 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\ |
398 If optional fifth arg MUST-SUFFIX is non-nil, insist on adding\n\ | |
399 the suffixe `.elc' or `.el'; don't accept just FILE.\n\ | |
398 Return t if file exists.") | 400 Return t if file exists.") |
399 (file, noerror, nomessage, nosuffix) | 401 (file, noerror, nomessage, nosuffix, must_suffix) |
400 Lisp_Object file, noerror, nomessage, nosuffix; | 402 Lisp_Object file, noerror, nomessage, nosuffix, must_suffix; |
401 { | 403 { |
402 register FILE *stream; | 404 register FILE *stream; |
403 register int fd = -1; | 405 register int fd = -1; |
404 register Lisp_Object lispstream; | 406 register Lisp_Object lispstream; |
405 int count = specpdl_ptr - specpdl; | 407 int count = specpdl_ptr - specpdl; |
430 /* Avoid weird lossage with null string as arg, | 432 /* Avoid weird lossage with null string as arg, |
431 since it would try to load a directory as a Lisp file */ | 433 since it would try to load a directory as a Lisp file */ |
432 if (XSTRING (file)->size > 0) | 434 if (XSTRING (file)->size > 0) |
433 { | 435 { |
434 GCPRO1 (file); | 436 GCPRO1 (file); |
435 fd = openp (Vload_path, file, !NILP (nosuffix) ? "" : ".elc:.el:", | 437 fd = openp (Vload_path, file, |
438 (!NILP (nosuffix) ? "" | |
439 : ! NILP (must_suffix) ? ".elc:.el" | |
440 : ".elc:.el:"), | |
436 &found, 0); | 441 &found, 0); |
437 UNGCPRO; | 442 UNGCPRO; |
438 } | 443 } |
439 | 444 |
440 if (fd < 0) | 445 if (fd < 0) |