changeset 34906:333a490b6ebc

(push_key_description): Add parameter FORCE_MULTIBYTE. If set, print multibyte text. (Fsingle_key_description): Call push_key_description with FORCE_MULTIBYTE set. (describe_buffer_bindings): Likewise.
author Gerd Moellmann <gerd@gnu.org>
date Thu, 28 Dec 2000 13:38:55 +0000
parents 19f10425ca8b
children cc3aa3f6232a
files src/keymap.c
diffstat 1 files changed, 21 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/src/keymap.c	Thu Dec 28 13:37:33 2000 +0000
+++ b/src/keymap.c	Thu Dec 28 13:38:55 2000 +0000
@@ -1768,9 +1768,10 @@
 }
 
 char *
-push_key_description (c, p)
+push_key_description (c, p, force_multibyte)
      register unsigned int c;
      register char *p;
+     int force_multibyte;
 {
   unsigned c2;
   
@@ -1859,13 +1860,23 @@
     }
   else if (c < 128
 	   || (NILP (current_buffer->enable_multibyte_characters)
-	       && SINGLE_BYTE_CHAR_P (c)))
-    *p++ = c;
+	       && SINGLE_BYTE_CHAR_P (c)
+	       && !force_multibyte))
+    {
+      *p++ = c;
+    }
   else
     {
-      if (NILP (current_buffer->enable_multibyte_characters)
-	  || SINGLE_BYTE_CHAR_P (c)
-	  || ! char_valid_p (c, 0))
+      int valid_p = SINGLE_BYTE_CHAR_P (c) || char_valid_p (c, 0);
+      
+      if (force_multibyte && valid_p)
+	{
+	  if (SINGLE_BYTE_CHAR_P (c))
+	    c = unibyte_char_to_multibyte (c);
+	  p += CHAR_STRING (c, p);
+	}
+      else if (NILP (current_buffer->enable_multibyte_characters)
+	       || valid_p)
 	{
 	  int bit_offset;
 	  *p++ = '\\';
@@ -1877,9 +1888,7 @@
 	    }
 	}
       else
-	{
-	  p += CHAR_STRING (c, p);
-	}
+	p += CHAR_STRING (c, p);
     }
 
   return p;  
@@ -1926,7 +1935,7 @@
 	{
 	  char tem[KEY_DESCRIPTION_SIZE];
 
-	  *push_key_description (XUINT (key), tem) = 0;
+	  *push_key_description (XUINT (key), tem, 1) = 0;
 	  return build_string (tem);
 	}
     }
@@ -2445,10 +2454,10 @@
 		alternate_heading = 0;
 	      }
 
-	    bufend = push_key_description (translate[c], buf);
+	    bufend = push_key_description (translate[c], buf, 1);
 	    insert (buf, bufend - buf);
 	    Findent_to (make_number (16), make_number (1));
-	    bufend = push_key_description (c, buf);
+	    bufend = push_key_description (c, buf, 1);
 	    insert (buf, bufend - buf);
 
 	    insert ("\n", 1);