[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Nonexistent vs. empty resources
From: |
Juanma Barranquero |
Subject: |
Nonexistent vs. empty resources |
Date: |
Fri, 18 Sep 2009 15:21:20 +0200 |
Currently, at least on Windows, with no Emacs.Font registry setting,
emacs -q defaults to
uniscribe:-outline-Courier
New-normal-normal-normal-mono-13-*-*-*-c-*-iso8859-1
while having an empy Emacs.Font resource, or doing "emacs -q -xrm
Emacs.Font:", results in some other font, in my case
uniscribe:-outline-FreeIdgSerif-normal-normal-normal-serif-16-*-*-*-p-*-iso8859-1
Now, the reason is quite clear. In frame.c:xrdb_get_resource() there
is this code:
if (value != (char *) 0)
return build_string (value);
else
return Qnil;
so in this case, an empty string "" is being returned. And most
font-dealing code does not expect an empty-string face spec.
The question is: where to fix it? There are at least three places:
1) x_get_string_resource: it could be argued that an empty setting is
no setting at all; that means deciding whether
emacs -q -xrm Emacs.Myresource:
would override a registry setting, or just be ignored. Note that,
for many resources, this overriding makes sense:
emacs -q -xrm Emacs.Background: -xrm Emacs.Foreground:
can be useful sometimes.
2) xrdb_get_resource: similar, though at this point, the overriding
would work (because the search has finalized, empty string or not).
3) On the functions that don't quite do the right thing with an empty
font spec. Fixing it here is messy, because it's not just making sure
x_default_font_parameter opens the right default font, but also
tweaking x_default_parameter, and perhaps other places.
I'd opt for 2). The fix is easy and IMHO the behavior matches expectations.
Juanma
--- a/src/frame.c
+++ b/src/frame.c
@@ -3854,7 +3854,7 @@ xrdb_get_resource (rdb, attribute, class,
component, subclass)
value = x_get_string_resource (rdb, name_key, class_key);
- if (value != (char *) 0)
+ if (value != (char *) 0 && *value)
return build_string (value);
else
return Qnil;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Nonexistent vs. empty resources,
Juanma Barranquero <=