From: Gerd Moellmann Date: Thu, 28 Dec 2000 13:38:55 +0000 (+0000) Subject: (push_key_description): Add parameter FORCE_MULTIBYTE. X-Git-Tag: emacs-pretest-21.0.95~247 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=f1cb0a258473258fa307806cad134de0d25970f5;p=emacs.git (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. --- diff --git a/src/keymap.c b/src/keymap.c index 0c1a1146d15..094dac4d13c 100644 --- a/src/keymap.c +++ b/src/keymap.c @@ -1768,9 +1768,10 @@ spaces are put between sequence elements, etc.") } 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 @@ push_key_description (c, p) } 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 @@ push_key_description (c, p) } } else - { - p += CHAR_STRING (c, p); - } + p += CHAR_STRING (c, p); } return p; @@ -1926,7 +1935,7 @@ around function keys and event symbols.") { 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 @@ You type Translation\n\ 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);