Mercurial > hg > xemacs-beta
comparison src/device-x.c @ 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 | 4d52aea479a2 |
children | f6f6fc9eb269 |
comparison
equal
deleted
inserted
replaced
3643:86be8d3dd45d | 3644:cb9e9a46686b |
---|---|
663 data-directory/app-defaults/$LANG/Emacs. | 663 data-directory/app-defaults/$LANG/Emacs. |
664 This is in addition to the standard app-defaults files, and | 664 This is in addition to the standard app-defaults files, and |
665 does not override resources defined elsewhere */ | 665 does not override resources defined elsewhere */ |
666 const Extbyte *data_dir; | 666 const Extbyte *data_dir; |
667 Extbyte *path; | 667 Extbyte *path; |
668 Extbyte *format; | |
668 XrmDatabase db = XtDatabase (dpy); /* #### XtScreenDatabase(dpy) ? */ | 669 XrmDatabase db = XtDatabase (dpy); /* #### XtScreenDatabase(dpy) ? */ |
669 const Extbyte *locale = XrmLocaleOfDatabase (db); | 670 Extbyte *locale = xstrdup (XrmLocaleOfDatabase (db)); |
671 Extbyte *locale_end; | |
670 | 672 |
671 if (STRINGP (Vx_app_defaults_directory) && | 673 if (STRINGP (Vx_app_defaults_directory) && |
672 XSTRING_LENGTH (Vx_app_defaults_directory) > 0) | 674 XSTRING_LENGTH (Vx_app_defaults_directory) > 0) |
673 { | 675 { |
674 LISP_STRING_TO_EXTERNAL (Vx_app_defaults_directory, data_dir, | 676 LISP_STRING_TO_EXTERNAL (Vx_app_defaults_directory, data_dir, |
675 Qfile_name); | 677 Qfile_name); |
676 path = alloca_extbytes (strlen (data_dir) + strlen (locale) + 7); | 678 path = alloca_extbytes (strlen (data_dir) + strlen (locale) + 7); |
677 sprintf (path, "%s%s/Emacs", data_dir, locale); | 679 format = "%s%s/Emacs"; |
678 if (!access (path, R_OK)) | |
679 XrmCombineFileDatabase (path, &db, False); | |
680 } | 680 } |
681 else if (STRINGP (Vdata_directory) && XSTRING_LENGTH (Vdata_directory) > 0) | 681 else if (STRINGP (Vdata_directory) && XSTRING_LENGTH (Vdata_directory) > 0) |
682 { | 682 { |
683 LISP_STRING_TO_EXTERNAL (Vdata_directory, data_dir, Qfile_name); | 683 LISP_STRING_TO_EXTERNAL (Vdata_directory, data_dir, Qfile_name); |
684 path = alloca_extbytes (strlen (data_dir) + 13 + strlen (locale) + 7); | 684 path = alloca_extbytes (strlen (data_dir) + 13 + strlen (locale) + 7); |
685 sprintf (path, "%sapp-defaults/%s/Emacs", data_dir, locale); | 685 format = "%sapp-defaults/%s/Emacs"; |
686 if (!access (path, R_OK)) | |
687 XrmCombineFileDatabase (path, &db, False); | |
688 } | 686 } |
687 | |
688 /* | |
689 * The general form for $LANG is <language>_<country>.<encoding>. Try | |
690 * that form, <language>_<country> and <language> and load for first | |
691 * app-defaults file found. | |
692 */ | |
693 | |
694 sprintf (path, format, data_dir, locale); | |
695 if (!access (path, R_OK)) | |
696 XrmCombineFileDatabase (path, &db, False); | |
697 | |
698 if ((locale_end = strchr(locale, '.'))) { | |
699 *locale_end = '\0'; | |
700 sprintf (path, format, data_dir, locale); | |
701 | |
702 if (!access (path, R_OK)) | |
703 XrmCombineFileDatabase (path, &db, False); | |
704 } | |
705 | |
706 if ((locale_end = strchr(locale, '_'))) { | |
707 *locale_end = '\0'; | |
708 sprintf (path, format, data_dir, locale); | |
709 | |
710 if (!access (path, R_OK)) | |
711 XrmCombineFileDatabase (path, &db, False); | |
712 } | |
713 | |
714 xfree (locale, Extbyte*); | |
689 } | 715 } |
690 #endif /* MULE */ | 716 #endif /* MULE */ |
691 | 717 |
692 if (NILP (DEVICE_NAME (d))) | 718 if (NILP (DEVICE_NAME (d))) |
693 DEVICE_NAME (d) = display; | 719 DEVICE_NAME (d) = display; |