emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

src/xrdb.c: Resource file scan


From: Yukihiro Nakai
Subject: src/xrdb.c: Resource file scan
Date: Fri, 20 Sep 2002 17:20:45 +0900

Hi all,

There is a description about how to use '%l' in src/xrdb.c:

/* Expand all the Xt-style %-escapes in STRING, whose length is given
   by STRING_LEN.  Here are the escapes we're supposed to recognize:

        %N      The value of the application's class name
        %T      The value of the type parameter ("app-defaults" in this
                context)
        %S      The value of the suffix parameter ("" in this context)
        %L      The language string associated with the specified display
                (We use the "LANG" environment variable here, if it's set.)
        %l      The language part of the display's language string
                (We treat this just like %L.  If someone can tell us what
                 we're really supposed to do, dandy.)

...

And I've some suggestions about this. For ideal, language search should be this
order for fallbacks. For example, usual Japanese locale name for glibc is 
ja_JP.eucJP,

1) ja_JP.eucJP (Exact match)
2) ja_JP (No charset)
3) ja (No region)

Sofor ideal, Emacs resource file search order should be like this(when 
LANG=ja_JP.eucJP):

1) /usr/X11R6/lib/X11/ja_JP.eucJP/app-defaults/Emacs
2) /usr/X11R6/lib/X11/ja_JP/app-defaults/Emacs
3) /usr/X11R6/lib/X11/ja/app-defaults/Emacs

There was some such code in Emacs, so here is a small patch to improve some:
--- src/xrdb.c.orig     2002-09-20 16:43:24.000000000 +0900
+++ src/xrdb.c  2002-09-20 16:46:44.000000000 +0900
@@ -223,7 +223,6 @@
                break;
 
              case 'L':
-             case 'l':
                if (! lang)
                  {
                    free (path);
@@ -234,6 +233,17 @@
                next_len = strlen (next);
                break;
 
+             case 'l':
+               if (! lang)
+                 {
+                   free (path);
+                   return NULL;
+                 }
+
+               next = (char*)strndup(lang, 2);
+               next_len = strlen (next);
+               break;
+
              case 't':
              case 'c':
                free (path);


Thanks,
--
Yukihiro Nakai, Red Hat Japan, Development




reply via email to

[Prev in Thread] Current Thread [Next in Thread]