all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Nonexistent vs. empty resources
@ 2009-09-18 13:21 Juanma Barranquero
  0 siblings, 0 replies; only message in thread
From: Juanma Barranquero @ 2009-09-18 13:21 UTC (permalink / raw)
  To: Emacs developers

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;




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-09-18 13:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-18 13:21 Nonexistent vs. empty resources Juanma Barranquero

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.