diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/charset.c | 34 |
1 files changed, 25 insertions, 9 deletions
diff --git a/src/charset.c b/src/charset.c index a9c79fe169d..55cfe717d3d 100644 --- a/src/charset.c +++ b/src/charset.c | |||
| @@ -329,15 +329,23 @@ int | |||
| 329 | unibyte_char_to_multibyte (c) | 329 | unibyte_char_to_multibyte (c) |
| 330 | int c; | 330 | int c; |
| 331 | { | 331 | { |
| 332 | if (c >= 0240 && c < 0400) | 332 | if (c < 0400) |
| 333 | { | 333 | { |
| 334 | int c_save = c; | 334 | int c_save = c; |
| 335 | 335 | ||
| 336 | if (! NILP (Vnonascii_translation_table)) | 336 | if (! NILP (Vnonascii_translation_table)) |
| 337 | c = XINT (Faref (Vnonascii_translation_table, make_number (c))); | 337 | { |
| 338 | else if (nonascii_insert_offset > 0) | 338 | c = XINT (Faref (Vnonascii_translation_table, make_number (c))); |
| 339 | c += nonascii_insert_offset; | 339 | if (c >= 0400 && ! VALID_MULTIBYTE_CHAR_P (c)) |
| 340 | if (c >= 0240 && (c < 0400 || ! VALID_MULTIBYTE_CHAR_P (c))) | 340 | c = c_save + DEFAULT_NONASCII_INSERT_OFFSET; |
| 341 | } | ||
| 342 | else if (c >= 0240 && nonascii_insert_offset > 0) | ||
| 343 | { | ||
| 344 | c += nonascii_insert_offset; | ||
| 345 | if (c < 0400 || ! VALID_MULTIBYTE_CHAR_P (c)) | ||
| 346 | c = c_save + DEFAULT_NONASCII_INSERT_OFFSET; | ||
| 347 | } | ||
| 348 | else if (c >= 0240) | ||
| 341 | c = c_save + DEFAULT_NONASCII_INSERT_OFFSET; | 349 | c = c_save + DEFAULT_NONASCII_INSERT_OFFSET; |
| 342 | } | 350 | } |
| 343 | return c; | 351 | return c; |
| @@ -369,11 +377,16 @@ multibyte_char_to_unibyte (c, rev_tbl) | |||
| 369 | temp = Faref (rev_tbl, make_number (c)); | 377 | temp = Faref (rev_tbl, make_number (c)); |
| 370 | if (INTEGERP (temp)) | 378 | if (INTEGERP (temp)) |
| 371 | c = XINT (temp); | 379 | c = XINT (temp); |
| 380 | if (c >= 256) | ||
| 381 | c = (c_save & 0177) + 0200; | ||
| 382 | } | ||
| 383 | else | ||
| 384 | { | ||
| 385 | if (nonascii_insert_offset > 0) | ||
| 386 | c -= nonascii_insert_offset; | ||
| 387 | if (c < 128 || c >= 256) | ||
| 388 | c = (c_save & 0177) + 0200; | ||
| 372 | } | 389 | } |
| 373 | else if (nonascii_insert_offset > 0) | ||
| 374 | c -= nonascii_insert_offset; | ||
| 375 | if (c < 128 || c >= 256) | ||
| 376 | c = (c_save & 0177) + 0200; | ||
| 377 | } | 390 | } |
| 378 | 391 | ||
| 379 | return c; | 392 | return c; |
| @@ -1806,6 +1819,9 @@ init_charset_once () | |||
| 1806 | val = Fcons (make_number (GENERIC_COMPOSITION_CHAR), val); | 1819 | val = Fcons (make_number (GENERIC_COMPOSITION_CHAR), val); |
| 1807 | Vgeneric_character_list = Fnreverse (val); | 1820 | Vgeneric_character_list = Fnreverse (val); |
| 1808 | } | 1821 | } |
| 1822 | |||
| 1823 | nonascii_insert_offset = 0; | ||
| 1824 | Vnonascii_translation_table = Qnil; | ||
| 1809 | } | 1825 | } |
| 1810 | 1826 | ||
| 1811 | #ifdef emacs | 1827 | #ifdef emacs |