Mercurial > hg > xemacs-beta
changeset 3644:cb9e9a46686b
[xemacs-hg @ 2006-10-30 11:36:59 by malcolmp]
device-x.c: Look in more directories when searching for the locale specific
app-defaults files.
author | malcolmp |
---|---|
date | Mon, 30 Oct 2006 11:37:01 +0000 |
parents | 86be8d3dd45d |
children | bb49f3386667 |
files | src/ChangeLog src/device-x.c |
diffstat | 2 files changed, 38 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog Mon Oct 30 11:17:46 2006 +0000 +++ b/src/ChangeLog Mon Oct 30 11:37:01 2006 +0000 @@ -1,3 +1,8 @@ +2006-10-30 Malcolm Purvis <malcolmp@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@parhasard.net> * event-xlike-inc.c:
--- a/src/device-x.c Mon Oct 30 11:17:46 2006 +0000 +++ b/src/device-x.c Mon Oct 30 11:37:01 2006 +0000 @@ -665,8 +665,10 @@ 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 @@ 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 */