Remove the vc-dir-insert-directories global.
[bpt/emacs.git] / src / character.c
index 457d57f..828e220 100644 (file)
@@ -326,9 +326,7 @@ DEFUN ("max-char", Fmax_char, Smax_char, 0, 0, 0,
 
 DEFUN ("unibyte-char-to-multibyte", Funibyte_char_to_multibyte,
        Sunibyte_char_to_multibyte, 1, 1, 0,
-       doc: /* Convert the unibyte character CH to multibyte character.
-The multibyte character is a result of decoding CH by
-the current unibyte charset (see `unibyte-charset').  */)
+       doc: /* Convert the byte CH to multibyte character.  */)
      (ch)
      Lisp_Object ch;
 {
@@ -348,23 +346,30 @@ the current unibyte charset (see `unibyte-charset').  */)
 
 DEFUN ("multibyte-char-to-unibyte", Fmultibyte_char_to_unibyte,
        Smultibyte_char_to_unibyte, 1, 1, 0,
-       doc: /* Convert the multibyte character CH to unibyte character.\n\
-The unibyte character is a result of encoding CH by
-the current primary charset (value of `charset-primary').  */)
+       doc: /* Convert the multibyte character CH to a byte.
+If the multibyte character does not represent a byte, return -1.  */)
      (ch)
      Lisp_Object ch;
 {
-  int c;
+  int cm;
 
   CHECK_CHARACTER (ch);
-  c = XFASTINT (ch);
-  c = CHAR_TO_BYTE8 (c);
-  return make_number (c);
+  cm = XFASTINT (ch);
+  if (cm < 256)
+    /* Can't distinguish a byte read from a unibyte buffer from
+       a latin1 char, so let's let it slide.  */
+    return ch;
+  else
+    {
+      int cu = CHAR_TO_BYTE8 (cm);
+      return make_number (cu);
+    }
 }
 
 DEFUN ("char-bytes", Fchar_bytes, Schar_bytes, 1, 1, 0,
        doc: /* Return 1 regardless of the argument CHAR.
-This is now an obsolete function.  We keep it just for backward compatibility.  */)
+This is now an obsolete function.  We keep it just for backward compatibility.
+usage: (char-bytes CHAR)  */)
      (ch)
      Lisp_Object ch;
 {
@@ -375,7 +380,8 @@ This is now an obsolete function.  We keep it just for backward compatibility.
 DEFUN ("char-width", Fchar_width, Schar_width, 1, 1, 0,
        doc: /* Return width of CHAR when displayed in the current buffer.
 The width is measured by how many columns it occupies on the screen.
-Tab is taken to occupy `tab-width' columns.  */)
+Tab is taken to occupy `tab-width' columns.
+usage: (char-width CHAR)  */)
      (ch)
        Lisp_Object ch;
 {
@@ -552,7 +558,8 @@ Width is measured by how many columns it occupies on the screen.
 When calculating width of a multibyte character in STRING,
 only the base leading-code is considered; the validity of
 the following bytes is not checked.  Tabs in STRING are always
-taken to occupy `tab-width' columns.  */)
+taken to occupy `tab-width' columns.
+usage: (string-width STRING)  */)
      (str)
      Lisp_Object str;
 {
@@ -565,7 +572,8 @@ taken to occupy `tab-width' columns.  */)
 
 DEFUN ("char-direction", Fchar_direction, Schar_direction, 1, 1, 0,
        doc: /* Return the direction of CHAR.
-The returned value is 0 for left-to-right and 1 for right-to-left.  */)
+The returned value is 0 for left-to-right and 1 for right-to-left.
+usage: (char-direction CHAR)  */)
      (ch)
      Lisp_Object ch;
 {