diff options
| author | Kenichi Handa | 2008-05-14 01:22:48 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2008-05-14 01:22:48 +0000 |
| commit | 6a9c90ecda143ad3d896f797a4964fcdf51ee2ec (patch) | |
| tree | 0ca7afb22d8614061f061e7746bda3c79345abfa /src | |
| parent | 370cefff000b401adb0ed2d45dac62273dc13758 (diff) | |
| download | emacs-6a9c90ecda143ad3d896f797a4964fcdf51ee2ec.tar.gz emacs-6a9c90ecda143ad3d896f797a4964fcdf51ee2ec.zip | |
(Vcharset_non_preferred_head): New variable.
(Vcurrent_iso639_language): New variable.
(syms_of_charset): Declare it as a Lisp variable.
(char_charset): Don't check non preferred charsets. As a last
resort, return charset_unicode.
(Fset_charset_priority): Update Vcharset_non_preferred_head.
Diffstat (limited to 'src')
| -rw-r--r-- | src/charset.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/charset.c b/src/charset.c index 5fe7e43a7a8..121cea7521d 100644 --- a/src/charset.c +++ b/src/charset.c | |||
| @@ -97,6 +97,10 @@ int charset_unibyte; | |||
| 97 | /* List of charsets ordered by the priority. */ | 97 | /* List of charsets ordered by the priority. */ |
| 98 | Lisp_Object Vcharset_ordered_list; | 98 | Lisp_Object Vcharset_ordered_list; |
| 99 | 99 | ||
| 100 | /* Sub-list of Vcharset_ordered_list that contains all non-preferred | ||
| 101 | charsets. */ | ||
| 102 | Lisp_Object Vcharset_non_preferred_head; | ||
| 103 | |||
| 100 | /* Incremented everytime we change Vcharset_ordered_list. This is | 104 | /* Incremented everytime we change Vcharset_ordered_list. This is |
| 101 | unsigned short so that it fits in Lisp_Int and never matches | 105 | unsigned short so that it fits in Lisp_Int and never matches |
| 102 | -1. */ | 106 | -1. */ |
| @@ -118,6 +122,8 @@ Lisp_Object Vcharset_map_path; | |||
| 118 | 122 | ||
| 119 | Lisp_Object Vchar_unified_charset_table; | 123 | Lisp_Object Vchar_unified_charset_table; |
| 120 | 124 | ||
| 125 | Lisp_Object Vcurrent_iso639_language; | ||
| 126 | |||
| 121 | /* Defined in chartab.c */ | 127 | /* Defined in chartab.c */ |
| 122 | extern void | 128 | extern void |
| 123 | map_char_table_for_charset P_ ((void (*c_function) (Lisp_Object, Lisp_Object), | 129 | map_char_table_for_charset P_ ((void (*c_function) (Lisp_Object, Lisp_Object), |
| @@ -1810,7 +1816,8 @@ char_charset (c, charset_list, code_return) | |||
| 1810 | if (NILP (charset_list)) | 1816 | if (NILP (charset_list)) |
| 1811 | charset_list = Vcharset_ordered_list; | 1817 | charset_list = Vcharset_ordered_list; |
| 1812 | 1818 | ||
| 1813 | while (CONSP (charset_list)) | 1819 | while (CONSP (charset_list) |
| 1820 | && ! EQ (charset_list, Vcharset_non_preferred_head)) | ||
| 1814 | { | 1821 | { |
| 1815 | struct charset *charset = CHARSET_FROM_ID (XINT (XCAR (charset_list))); | 1822 | struct charset *charset = CHARSET_FROM_ID (XINT (XCAR (charset_list))); |
| 1816 | unsigned code = ENCODE_CHAR (charset, c); | 1823 | unsigned code = ENCODE_CHAR (charset, c); |
| @@ -1823,7 +1830,8 @@ char_charset (c, charset_list, code_return) | |||
| 1823 | } | 1830 | } |
| 1824 | charset_list = XCDR (charset_list); | 1831 | charset_list = XCDR (charset_list); |
| 1825 | } | 1832 | } |
| 1826 | return NULL; | 1833 | return (c <= MAX_UNICODE_CHAR ? CHARSET_FROM_ID (charset_unicode) |
| 1834 | : CHARSET_FROM_ID (charset_eight_bit)); | ||
| 1827 | } | 1835 | } |
| 1828 | 1836 | ||
| 1829 | 1837 | ||
| @@ -1994,7 +2002,7 @@ usage: (set-charset-priority &rest charsets) */) | |||
| 1994 | } | 2002 | } |
| 1995 | } | 2003 | } |
| 1996 | arglist[0] = Fnreverse (new_head); | 2004 | arglist[0] = Fnreverse (new_head); |
| 1997 | arglist[1] = old_list; | 2005 | arglist[1] = Vcharset_non_preferred_head = old_list; |
| 1998 | Vcharset_ordered_list = Fnconc (2, arglist); | 2006 | Vcharset_ordered_list = Fnconc (2, arglist); |
| 1999 | charset_ordered_list_tick++; | 2007 | charset_ordered_list_tick++; |
| 2000 | 2008 | ||
| @@ -2133,6 +2141,12 @@ syms_of_charset () | |||
| 2133 | doc: /* List of all charsets ever defined. */); | 2141 | doc: /* List of all charsets ever defined. */); |
| 2134 | Vcharset_list = Qnil; | 2142 | Vcharset_list = Qnil; |
| 2135 | 2143 | ||
| 2144 | DEFVAR_LISP ("current-iso639-language", &Vcurrent_iso639_language, | ||
| 2145 | doc: /* ISO639 language mnemonic symbol for the current language environment. | ||
| 2146 | If the current language environment is for multiple languages (e.g. "Latin-1"), | ||
| 2147 | the value may be a list of mnemonics. */); | ||
| 2148 | Vcurrent_iso639_language = Qnil; | ||
| 2149 | |||
| 2136 | charset_ascii | 2150 | charset_ascii |
| 2137 | = define_charset_internal (Qascii, 1, "\x00\x7F\x00\x00\x00\x00", | 2151 | = define_charset_internal (Qascii, 1, "\x00\x7F\x00\x00\x00\x00", |
| 2138 | 0, 127, 'B', -1, 0, 1, 0, 0); | 2152 | 0, 127, 'B', -1, 0, 1, 0, 0); |