aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorStefan Monnier2001-10-12 21:42:09 +0000
committerStefan Monnier2001-10-12 21:42:09 +0000
commit65550192d8acbff6845f79ed3f2b260fd611779d (patch)
tree37a527b430c27ee1a686f287a44406fb5fef55b2 /src
parent026f408dc81a8cbfa78916b5757252d966730d8a (diff)
downloademacs-65550192d8acbff6845f79ed3f2b260fd611779d.tar.gz
emacs-65550192d8acbff6845f79ed3f2b260fd611779d.zip
(Ffeaturep): Add new `subfeature' arg.
(Fprovide): Add new `subfeatures' arg. Use `after-load-alist'. (Qsubfeatures): New var. (syms_of_fns): Initialize it.
Diffstat (limited to 'src')
-rw-r--r--src/fns.c34
1 files changed, 25 insertions, 9 deletions
diff --git a/src/fns.c b/src/fns.c
index 162bc16ad2b..46f1b6aaa9e 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -3022,27 +3022,33 @@ shortened list, containing only those averages which are available.")
3022 return ret; 3022 return ret;
3023} 3023}
3024 3024
3025Lisp_Object Vfeatures; 3025Lisp_Object Vfeatures, Qsubfeatures, Vafter_load_alist;
3026 3026
3027DEFUN ("featurep", Ffeaturep, Sfeaturep, 1, 1, 0, 3027DEFUN ("featurep", Ffeaturep, Sfeaturep, 1, 2, 0,
3028 "Returns t if FEATURE is present in this Emacs.\n\ 3028 "Returns t if FEATURE is present in this Emacs.\n\
3029Use this to conditionalize execution of lisp code based on the presence or\n\ 3029Use this to conditionalize execution of lisp code based on the presence or\n\
3030absence of emacs or environment extensions.\n\ 3030absence of emacs or environment extensions.\n\
3031Use `provide' to declare that a feature is available.\n\ 3031Use `provide' to declare that a feature is available.\n\
3032This function looks at the value of the variable `features'.") 3032This function looks at the value of the variable `features'.\n\
3033 (feature) 3033The optional argument SUBFEATURE can be used to check a specific\n\
3034 Lisp_Object feature; 3034subfeature of FEATURE.")
3035 (feature, subfeature)
3036 Lisp_Object feature, subfeature;
3035{ 3037{
3036 register Lisp_Object tem; 3038 register Lisp_Object tem;
3037 CHECK_SYMBOL (feature, 0); 3039 CHECK_SYMBOL (feature, 0);
3038 tem = Fmemq (feature, Vfeatures); 3040 tem = Fmemq (feature, Vfeatures);
3041 if (!NILP (tem) && !NILP (subfeature))
3042 tem = Fmemq (subfeature, Fget (feature, Qsubfeatures));
3039 return (NILP (tem)) ? Qnil : Qt; 3043 return (NILP (tem)) ? Qnil : Qt;
3040} 3044}
3041 3045
3042DEFUN ("provide", Fprovide, Sprovide, 1, 1, 0, 3046DEFUN ("provide", Fprovide, Sprovide, 1, 2, 0,
3043 "Announce that FEATURE is a feature of the current Emacs.") 3047 "Announce that FEATURE is a feature of the current Emacs.\n\
3044 (feature) 3048The optional argument SUBFEATURES should be a list of symbols listing\n\
3045 Lisp_Object feature; 3049particular subfeatures supported in this version of FEATURE.")
3050 (feature, subfeatures)
3051 Lisp_Object feature, subfeatures;
3046{ 3052{
3047 register Lisp_Object tem; 3053 register Lisp_Object tem;
3048 CHECK_SYMBOL (feature, 0); 3054 CHECK_SYMBOL (feature, 0);
@@ -3051,7 +3057,15 @@ DEFUN ("provide", Fprovide, Sprovide, 1, 1, 0,
3051 tem = Fmemq (feature, Vfeatures); 3057 tem = Fmemq (feature, Vfeatures);
3052 if (NILP (tem)) 3058 if (NILP (tem))
3053 Vfeatures = Fcons (feature, Vfeatures); 3059 Vfeatures = Fcons (feature, Vfeatures);
3060 if (!NILP (subfeatures))
3061 Fput (feature, Qsubfeatures, subfeatures);
3054 LOADHIST_ATTACH (Fcons (Qprovide, feature)); 3062 LOADHIST_ATTACH (Fcons (Qprovide, feature));
3063
3064 /* Run any load-hooks for this file. */
3065 tem = Fassq (feature, Vafter_load_alist);
3066 if (!NILP (tem))
3067 Fprogn (Fcdr (tem));
3068
3055 return feature; 3069 return feature;
3056} 3070}
3057 3071
@@ -5253,6 +5267,8 @@ syms_of_fns ()
5253 "A list of symbols which are the features of the executing emacs.\n\ 5267 "A list of symbols which are the features of the executing emacs.\n\
5254Used by `featurep' and `require', and altered by `provide'."); 5268Used by `featurep' and `require', and altered by `provide'.");
5255 Vfeatures = Qnil; 5269 Vfeatures = Qnil;
5270 Qsubfeatures = intern ("subfeatures");
5271 staticpro (&Qsubfeatures);
5256 5272
5257 DEFVAR_BOOL ("use-dialog-box", &use_dialog_box, 5273 DEFVAR_BOOL ("use-dialog-box", &use_dialog_box,
5258 "*Non-nil means mouse commands use dialog boxes to ask questions.\n\ 5274 "*Non-nil means mouse commands use dialog boxes to ask questions.\n\