Mercurial > hg > xemacs-beta
comparison src/fns.c @ 1067:a0a7ace216fe
[xemacs-hg @ 2002-10-24 13:55:42 by youngs]
2002-10-24 John Paul Wallington <jpw@shootybangbang.com>
* fns.c (Frequire): Add optional `noerror' argument.
author | youngs |
---|---|
date | Thu, 24 Oct 2002 13:55:49 +0000 |
parents | 7a35465d73bc |
children | e22b0213b713 |
comparison
equal
deleted
inserted
replaced
1066:5de13d96e131 | 1067:a0a7ace216fe |
---|---|
3544 Vfeatures = Fcons (feature, Vfeatures); | 3544 Vfeatures = Fcons (feature, Vfeatures); |
3545 LOADHIST_ATTACH (Fcons (Qprovide, feature)); | 3545 LOADHIST_ATTACH (Fcons (Qprovide, feature)); |
3546 return feature; | 3546 return feature; |
3547 } | 3547 } |
3548 | 3548 |
3549 DEFUN ("require", Frequire, 1, 2, 0, /* | 3549 DEFUN ("require", Frequire, 1, 3, 0, /* |
3550 If feature FEATURE is not loaded, load it from FILENAME. | 3550 If feature FEATURE is not loaded, load it from FILENAME. |
3551 If FEATURE is not a member of the list `features', then the feature | 3551 If FEATURE is not a member of the list `features', then the feature |
3552 is not loaded; so load the file FILENAME. | 3552 is not loaded; so load the file FILENAME. |
3553 If FILENAME is omitted, the printname of FEATURE is used as the file name. | 3553 If FILENAME is omitted, the printname of FEATURE is used as the file name. |
3554 */ | 3554 If optional third argument NOERROR is non-nil, then return nil if the file |
3555 (feature, filename)) | 3555 is not found instead of signaling an error. |
3556 */ | |
3557 (feature, filename, noerror)) | |
3556 { | 3558 { |
3557 Lisp_Object tem; | 3559 Lisp_Object tem; |
3558 CHECK_SYMBOL (feature); | 3560 CHECK_SYMBOL (feature); |
3559 tem = Fmemq (feature, Vfeatures); | 3561 tem = Fmemq (feature, Vfeatures); |
3560 LOADHIST_ATTACH (Fcons (Qrequire, feature)); | 3562 LOADHIST_ATTACH (Fcons (Qrequire, feature)); |
3566 | 3568 |
3567 /* Value saved here is to be restored into Vautoload_queue */ | 3569 /* Value saved here is to be restored into Vautoload_queue */ |
3568 record_unwind_protect (un_autoload, Vautoload_queue); | 3570 record_unwind_protect (un_autoload, Vautoload_queue); |
3569 Vautoload_queue = Qt; | 3571 Vautoload_queue = Qt; |
3570 | 3572 |
3571 call4 (Qload, NILP (filename) ? Fsymbol_name (feature) : filename, | 3573 tem = call4 (Qload, NILP (filename) ? Fsymbol_name (feature) : filename, |
3572 Qnil, require_prints_loading_message ? Qrequire : Qt, Qnil); | 3574 noerror, require_prints_loading_message ? Qrequire : Qt, Qnil); |
3575 /* If load failed entirely, return nil. */ | |
3576 if (NILP (tem)) | |
3577 return unbind_to_1 (speccount, Qnil); | |
3573 | 3578 |
3574 tem = Fmemq (feature, Vfeatures); | 3579 tem = Fmemq (feature, Vfeatures); |
3575 if (NILP (tem)) | 3580 if (NILP (tem)) |
3576 invalid_state ("Required feature was not provided", feature); | 3581 invalid_state ("Required feature was not provided", feature); |
3577 | 3582 |