diff options
| author | Stefan Monnier | 2008-04-18 03:26:55 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2008-04-18 03:26:55 +0000 |
| commit | 5556875b184999982de635af7ae1371719699f7b (patch) | |
| tree | 6d12f6bd2719958f85af6be4063fb3ad9bf125dd /src | |
| parent | d02fe47dd3be7310d1bfd6e802d1fac2ea5f5e9d (diff) | |
| download | emacs-5556875b184999982de635af7ae1371719699f7b.tar.gz emacs-5556875b184999982de635af7ae1371719699f7b.zip | |
(Fmultibyte_char_to_unibyte): Return latin1 chars unchanged.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 2 | ||||
| -rw-r--r-- | src/character.c | 24 |
2 files changed, 16 insertions, 10 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index cf9bbe2d8bc..a0583ac0ce2 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -159,6 +159,8 @@ | |||
| 159 | 159 | ||
| 160 | 2008-04-18 Stefan Monnier <monnier@iro.umontreal.ca> | 160 | 2008-04-18 Stefan Monnier <monnier@iro.umontreal.ca> |
| 161 | 161 | ||
| 162 | * character.c (Fmultibyte_char_to_unibyte): Return latin1 chars unchanged. | ||
| 163 | |||
| 162 | * fileio.c (Fexpand_file_name): Refine last fix so `nm' is only | 164 | * fileio.c (Fexpand_file_name): Refine last fix so `nm' is only |
| 163 | relocated if it points to `name'. | 165 | relocated if it points to `name'. |
| 164 | 166 | ||
diff --git a/src/character.c b/src/character.c index a4e142e371c..828e2208132 100644 --- a/src/character.c +++ b/src/character.c | |||
| @@ -326,9 +326,7 @@ DEFUN ("max-char", Fmax_char, Smax_char, 0, 0, 0, | |||
| 326 | 326 | ||
| 327 | DEFUN ("unibyte-char-to-multibyte", Funibyte_char_to_multibyte, | 327 | DEFUN ("unibyte-char-to-multibyte", Funibyte_char_to_multibyte, |
| 328 | Sunibyte_char_to_multibyte, 1, 1, 0, | 328 | Sunibyte_char_to_multibyte, 1, 1, 0, |
| 329 | doc: /* Convert the unibyte character CH to multibyte character. | 329 | doc: /* Convert the byte CH to multibyte character. */) |
| 330 | The multibyte character is a result of decoding CH by | ||
| 331 | the current unibyte charset (see `unibyte-charset'). */) | ||
| 332 | (ch) | 330 | (ch) |
| 333 | Lisp_Object ch; | 331 | Lisp_Object ch; |
| 334 | { | 332 | { |
| @@ -348,18 +346,24 @@ the current unibyte charset (see `unibyte-charset'). */) | |||
| 348 | 346 | ||
| 349 | DEFUN ("multibyte-char-to-unibyte", Fmultibyte_char_to_unibyte, | 347 | DEFUN ("multibyte-char-to-unibyte", Fmultibyte_char_to_unibyte, |
| 350 | Smultibyte_char_to_unibyte, 1, 1, 0, | 348 | Smultibyte_char_to_unibyte, 1, 1, 0, |
| 351 | doc: /* Convert the multibyte character CH to unibyte character.\n\ | 349 | doc: /* Convert the multibyte character CH to a byte. |
| 352 | The unibyte character is a result of encoding CH by | 350 | If the multibyte character does not represent a byte, return -1. */) |
| 353 | the current primary charset (value of `charset-primary'). */) | ||
| 354 | (ch) | 351 | (ch) |
| 355 | Lisp_Object ch; | 352 | Lisp_Object ch; |
| 356 | { | 353 | { |
| 357 | int c; | 354 | int cm; |
| 358 | 355 | ||
| 359 | CHECK_CHARACTER (ch); | 356 | CHECK_CHARACTER (ch); |
| 360 | c = XFASTINT (ch); | 357 | cm = XFASTINT (ch); |
| 361 | c = CHAR_TO_BYTE8 (c); | 358 | if (cm < 256) |
| 362 | return make_number (c); | 359 | /* Can't distinguish a byte read from a unibyte buffer from |
| 360 | a latin1 char, so let's let it slide. */ | ||
| 361 | return ch; | ||
| 362 | else | ||
| 363 | { | ||
| 364 | int cu = CHAR_TO_BYTE8 (cm); | ||
| 365 | return make_number (cu); | ||
| 366 | } | ||
| 363 | } | 367 | } |
| 364 | 368 | ||
| 365 | DEFUN ("char-bytes", Fchar_bytes, Schar_bytes, 1, 1, 0, | 369 | DEFUN ("char-bytes", Fchar_bytes, Schar_bytes, 1, 1, 0, |