Mercurial > emacs
comparison src/xfns.c @ 1733:2d41a3d7b9a6
(Fx_get_resource): Use EMACS_CLASS to make class_key
even if SUBCLASS is specified. I don't know whether that is
right, but that's what the doc says.
Cosmetic changes in arg names and doc string.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sun, 03 Jan 1993 23:43:29 +0000 |
parents | 48f539ac6921 |
children | 5179baee010b |
comparison
equal
deleted
inserted
replaced
1732:2dd86a54c11b | 1733:2d41a3d7b9a6 |
---|---|
1281 #ifdef HAVE_X11 | 1281 #ifdef HAVE_X11 |
1282 extern char *x_get_string_resource (); | 1282 extern char *x_get_string_resource (); |
1283 extern XrmDatabase x_load_resources (); | 1283 extern XrmDatabase x_load_resources (); |
1284 | 1284 |
1285 DEFUN ("x-get-resource", Fx_get_resource, Sx_get_resource, 1, 3, 0, | 1285 DEFUN ("x-get-resource", Fx_get_resource, Sx_get_resource, 1, 3, 0, |
1286 "Retrieve the value of ATTRIBUTE from the X defaults database. This\n\ | 1286 "Retrieve the value of ATTRIBUTE from the X defaults database.\n\ |
1287 searches using a key of the form \"INSTANCE.ATTRIBUTE\", with class\n\ | 1287 This uses `Emacs' as the class and `INSTANCE.ATTRIBUTE' as the key,\n\ |
1288 \"Emacs\", where INSTANCE is the name under which Emacs was invoked.\n\ | 1288 where INSTANCE is the name under which Emacs was invoked.\n\ |
1289 \n\ | 1289 \n\ |
1290 Optional arguments COMPONENT and CLASS specify the component for which\n\ | 1290 The optional arguments COMPONENT and SUBCLASS add to the key and the\n\ |
1291 we should look up ATTRIBUTE. When specified, Emacs searches using a\n\ | 1291 class, respectively. You must specify both of them or neither.\n\ |
1292 key of the form INSTANCE.COMPONENT.ATTRIBUTE, with class \"Emacs.CLASS\".") | 1292 If you specify them, the key is `INSTANCE.COMPONENT.ATTRIBUTE'\n\ |
1293 (attribute, name, class) | 1293 and the class is `Emacs.SUBCLASS'.") |
1294 Lisp_Object attribute, name, class; | 1294 (attribute, component, subclass) |
1295 Lisp_Object attribute, component, subclass; | |
1295 { | 1296 { |
1296 register char *value; | 1297 register char *value; |
1297 char *name_key; | 1298 char *name_key; |
1298 char *class_key; | 1299 char *class_key; |
1299 | 1300 |
1300 CHECK_STRING (attribute, 0); | 1301 CHECK_STRING (attribute, 0); |
1301 if (!NILP (name)) | 1302 if (!NILP (component)) |
1302 CHECK_STRING (name, 1); | 1303 CHECK_STRING (component, 1); |
1303 if (!NILP (class)) | 1304 if (!NILP (subclass)) |
1304 CHECK_STRING (class, 2); | 1305 CHECK_STRING (subclass, 2); |
1305 if (NILP (name) != NILP (class)) | 1306 if (NILP (component) != NILP (subclass)) |
1306 error ("x-get-resource: must specify both NAME and CLASS or neither"); | 1307 error ("x-get-resource: must specify both COMPONENT and SUBCLASS or neither"); |
1307 | 1308 |
1308 if (NILP (name)) | 1309 if (NILP (component)) |
1309 { | 1310 { |
1310 name_key = (char *) alloca (XSTRING (invocation_name)->size + 1 | 1311 name_key = (char *) alloca (XSTRING (invocation_name)->size + 1 |
1311 + XSTRING (attribute)->size + 1); | 1312 + XSTRING (attribute)->size + 1); |
1312 | 1313 |
1313 sprintf (name_key, "%s.%s", | 1314 sprintf (name_key, "%s.%s", |
1316 class_key = EMACS_CLASS; | 1317 class_key = EMACS_CLASS; |
1317 } | 1318 } |
1318 else | 1319 else |
1319 { | 1320 { |
1320 name_key = (char *) alloca (XSTRING (invocation_name)->size + 1 | 1321 name_key = (char *) alloca (XSTRING (invocation_name)->size + 1 |
1321 + XSTRING (name)->size + 1 | 1322 + XSTRING (component)->size + 1 |
1322 + XSTRING (attribute)->size + 1); | 1323 + XSTRING (attribute)->size + 1); |
1323 | 1324 |
1324 class_key = (char *) alloca (sizeof (EMACS_CLASS) | 1325 class_key = (char *) alloca (sizeof (EMACS_CLASS) |
1325 + XSTRING (class)->size + 1); | 1326 + XSTRING (class)->size + 1); |
1326 | 1327 |
1327 sprintf (name_key, "%s.%s.%s", | 1328 sprintf (name_key, "%s.%s.%s", |
1328 XSTRING (invocation_name)->data, | 1329 XSTRING (invocation_name)->data, |
1329 XSTRING (name)->data, | 1330 XSTRING (component)->data, |
1330 XSTRING (attribute)->data); | 1331 XSTRING (attribute)->data); |
1331 sprintf (class_key, "%s.%s", | 1332 /* This used to have invocation_name instead of EMACS_CLASS, |
1332 XSTRING (invocation_name)->data, | 1333 but the doc string seems to say it should be EMACS_CLASS. */ |
1333 XSTRING (class)->data); | 1334 sprintf (class_key, "%s.%s", EMACS_CLASS, XSTRING (class)->data); |
1334 } | 1335 } |
1335 | 1336 |
1336 value = x_get_string_resource (xrdb, name_key, class_key); | 1337 value = x_get_string_resource (xrdb, name_key, class_key); |
1337 | 1338 |
1338 if (value != (char *) 0) | 1339 if (value != (char *) 0) |