Mercurial > emacs
changeset 94921:c2449f1de3ac
(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.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Wed, 14 May 2008 01:22:48 +0000 |
parents | 754dcec40ffe |
children | 181a3677061e |
files | src/charset.c |
diffstat | 1 files changed, 17 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/charset.c Wed May 14 01:22:19 2008 +0000 +++ b/src/charset.c Wed May 14 01:22:48 2008 +0000 @@ -97,6 +97,10 @@ /* List of charsets ordered by the priority. */ Lisp_Object Vcharset_ordered_list; +/* Sub-list of Vcharset_ordered_list that contains all non-preferred + charsets. */ +Lisp_Object Vcharset_non_preferred_head; + /* Incremented everytime we change Vcharset_ordered_list. This is unsigned short so that it fits in Lisp_Int and never matches -1. */ @@ -118,6 +122,8 @@ Lisp_Object Vchar_unified_charset_table; +Lisp_Object Vcurrent_iso639_language; + /* Defined in chartab.c */ extern void map_char_table_for_charset P_ ((void (*c_function) (Lisp_Object, Lisp_Object), @@ -1810,7 +1816,8 @@ if (NILP (charset_list)) charset_list = Vcharset_ordered_list; - while (CONSP (charset_list)) + while (CONSP (charset_list) + && ! EQ (charset_list, Vcharset_non_preferred_head)) { struct charset *charset = CHARSET_FROM_ID (XINT (XCAR (charset_list))); unsigned code = ENCODE_CHAR (charset, c); @@ -1823,7 +1830,8 @@ } charset_list = XCDR (charset_list); } - return NULL; + return (c <= MAX_UNICODE_CHAR ? CHARSET_FROM_ID (charset_unicode) + : CHARSET_FROM_ID (charset_eight_bit)); } @@ -1994,7 +2002,7 @@ } } arglist[0] = Fnreverse (new_head); - arglist[1] = old_list; + arglist[1] = Vcharset_non_preferred_head = old_list; Vcharset_ordered_list = Fnconc (2, arglist); charset_ordered_list_tick++; @@ -2133,6 +2141,12 @@ doc: /* List of all charsets ever defined. */); Vcharset_list = Qnil; + DEFVAR_LISP ("current-iso639-language", &Vcurrent_iso639_language, + doc: /* ISO639 language mnemonic symbol for the current language environment. +If the current language environment is for multiple languages (e.g. "Latin-1"), +the value may be a list of mnemonics. */); + Vcurrent_iso639_language = Qnil; + charset_ascii = define_charset_internal (Qascii, 1, "\x00\x7F\x00\x00\x00\x00", 0, 127, 'B', -1, 0, 1, 0, 0);