CVS update by malcolmp xemacs/src ...

xemacs-cvs at xemacs.org xemacs-cvs at xemacs.org
Mon Oct 30 06:37:04 EST 2006


  User: malcolmp
  Date: 06/10/30 12:37:04

  Modified:    xemacs/src ChangeLog device-x.c
Log:
device-x.c: Look in more directories when searching for the locale specific
app-defaults files.

Revision  Changes    Path
1.1003    +5 -0      XEmacs/xemacs/src/ChangeLog

Index: ChangeLog
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/ChangeLog,v
retrieving revision 1.1002
retrieving revision 1.1003
diff -u -p -r1.1002 -r1.1003
--- ChangeLog	2006/10/28 16:02:43	1.1002
+++ ChangeLog	2006/10/30 11:36:59	1.1003
@@ -1,3 +1,8 @@
+2006-10-30  Malcolm Purvis  <malcolmp at xemacs.org>
+
+	* device-x.c (x_init_device):  Look in more directories when
+	searching for the locale specific app-defaults files.
+
 2006-10-28  Aidan Kehoe  <kehoea at parhasard.net>
 
 	* event-xlike-inc.c:



1.68      +33 -7     XEmacs/xemacs/src/device-x.c

Index: device-x.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/device-x.c,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -p -r1.67 -r1.68
--- device-x.c	2006/06/21 17:30:35	1.67
+++ device-x.c	2006/10/30 11:37:01	1.68
@@ -665,8 +665,10 @@ x_init_device (struct device *d, Lisp_Ob
        does not override resources defined elsewhere */
     const Extbyte *data_dir;
     Extbyte *path;
+    Extbyte *format;
     XrmDatabase db = XtDatabase (dpy); /* #### XtScreenDatabase(dpy) ? */
-    const Extbyte *locale = XrmLocaleOfDatabase (db);
+    Extbyte *locale = xstrdup (XrmLocaleOfDatabase (db));
+    Extbyte *locale_end;
 
     if (STRINGP (Vx_app_defaults_directory) &&
 	XSTRING_LENGTH (Vx_app_defaults_directory) > 0)
@@ -674,18 +676,42 @@ x_init_device (struct device *d, Lisp_Ob
 	LISP_STRING_TO_EXTERNAL (Vx_app_defaults_directory, data_dir,
 				 Qfile_name);
 	path = alloca_extbytes (strlen (data_dir) + strlen (locale) + 7);
-	sprintf (path, "%s%s/Emacs", data_dir, locale);
-	if (!access (path, R_OK))
-	  XrmCombineFileDatabase (path, &db, False);
+	format = "%s%s/Emacs";
       }
     else if (STRINGP (Vdata_directory) && XSTRING_LENGTH (Vdata_directory) > 0)
       {
 	LISP_STRING_TO_EXTERNAL (Vdata_directory, data_dir, Qfile_name);
 	path = alloca_extbytes (strlen (data_dir) + 13 + strlen (locale) + 7);
-	sprintf (path, "%sapp-defaults/%s/Emacs", data_dir, locale);
-	if (!access (path, R_OK))
-	  XrmCombineFileDatabase (path, &db, False);
+	format = "%sapp-defaults/%s/Emacs";
       }
+
+    /*
+     * The general form for $LANG is <language>_<country>.<encoding>.  Try
+     * that form, <language>_<country> and <language> and load for first
+     * app-defaults file found.
+     */
+
+    sprintf (path, format, data_dir, locale);
+    if (!access (path, R_OK))
+      XrmCombineFileDatabase (path, &db, False);
+
+    if ((locale_end = strchr(locale, '.'))) {
+      *locale_end = '\0';
+      sprintf (path, format, data_dir, locale);
+
+      if (!access (path, R_OK))
+	XrmCombineFileDatabase (path, &db, False);
+    }
+
+    if ((locale_end = strchr(locale, '_'))) {
+      *locale_end = '\0';
+      sprintf (path, format, data_dir, locale);
+
+      if (!access (path, R_OK))
+	XrmCombineFileDatabase (path, &db, False);
+    }
+
+    xfree (locale, Extbyte*);
  }
 #endif /* MULE */
 





More information about the XEmacs-CVS mailing list