aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorStefan Monnier2008-04-18 03:26:55 +0000
committerStefan Monnier2008-04-18 03:26:55 +0000
commit5556875b184999982de635af7ae1371719699f7b (patch)
tree6d12f6bd2719958f85af6be4063fb3ad9bf125dd /src
parentd02fe47dd3be7310d1bfd6e802d1fac2ea5f5e9d (diff)
downloademacs-5556875b184999982de635af7ae1371719699f7b.tar.gz
emacs-5556875b184999982de635af7ae1371719699f7b.zip
(Fmultibyte_char_to_unibyte): Return latin1 chars unchanged.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog2
-rw-r--r--src/character.c24
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
1602008-04-18 Stefan Monnier <monnier@iro.umontreal.ca> 1602008-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
327DEFUN ("unibyte-char-to-multibyte", Funibyte_char_to_multibyte, 327DEFUN ("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. */)
330The multibyte character is a result of decoding CH by
331the 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
349DEFUN ("multibyte-char-to-unibyte", Fmultibyte_char_to_unibyte, 347DEFUN ("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.
352The unibyte character is a result of encoding CH by 350If the multibyte character does not represent a byte, return -1. */)
353the 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
365DEFUN ("char-bytes", Fchar_bytes, Schar_bytes, 1, 1, 0, 369DEFUN ("char-bytes", Fchar_bytes, Schar_bytes, 1, 1, 0,