aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman1993-01-03 23:43:29 +0000
committerRichard M. Stallman1993-01-03 23:43:29 +0000
commit8fabe6f428cb0d7a2055d641423d261dffb98369 (patch)
treefe150ef47ef6ede5f87b26e0fa63bfa64b443d3f /src
parentca8efa98ca802f1423ad8da11644c78eaac5f17b (diff)
downloademacs-8fabe6f428cb0d7a2055d641423d261dffb98369.tar.gz
emacs-8fabe6f428cb0d7a2055d641423d261dffb98369.zip
(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.
Diffstat (limited to 'src')
-rw-r--r--src/xfns.c41
1 files changed, 21 insertions, 20 deletions
diff --git a/src/xfns.c b/src/xfns.c
index d0826835d06..ec95aba0461 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -1283,29 +1283,30 @@ extern char *x_get_string_resource ();
1283extern XrmDatabase x_load_resources (); 1283extern XrmDatabase x_load_resources ();
1284 1284
1285DEFUN ("x-get-resource", Fx_get_resource, Sx_get_resource, 1, 3, 0, 1285DEFUN ("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\
1287searches using a key of the form \"INSTANCE.ATTRIBUTE\", with class\n\ 1287This 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\ 1288where INSTANCE is the name under which Emacs was invoked.\n\
1289\n\ 1289\n\
1290Optional arguments COMPONENT and CLASS specify the component for which\n\ 1290The optional arguments COMPONENT and SUBCLASS add to the key and the\n\
1291we should look up ATTRIBUTE. When specified, Emacs searches using a\n\ 1291class, respectively. You must specify both of them or neither.\n\
1292key of the form INSTANCE.COMPONENT.ATTRIBUTE, with class \"Emacs.CLASS\".") 1292If you specify them, the key is `INSTANCE.COMPONENT.ATTRIBUTE'\n\
1293 (attribute, name, class) 1293and 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);
@@ -1318,7 +1319,7 @@ key of the form INSTANCE.COMPONENT.ATTRIBUTE, with class \"Emacs.CLASS\".")
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)
@@ -1326,11 +1327,11 @@ key of the form INSTANCE.COMPONENT.ATTRIBUTE, with class \"Emacs.CLASS\".")
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);