diff options
Diffstat (limited to 'src/keymap.c')
| -rw-r--r-- | src/keymap.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/keymap.c b/src/keymap.c index c609ed6c4e4..31b9378d3ad 100644 --- a/src/keymap.c +++ b/src/keymap.c | |||
| @@ -2083,12 +2083,21 @@ push_key_description (c, p, force_multibyte) | |||
| 2083 | int force_multibyte; | 2083 | int force_multibyte; |
| 2084 | { | 2084 | { |
| 2085 | unsigned c2; | 2085 | unsigned c2; |
| 2086 | int valid_p; | ||
| 2086 | 2087 | ||
| 2087 | /* Clear all the meaningless bits above the meta bit. */ | 2088 | /* Clear all the meaningless bits above the meta bit. */ |
| 2088 | c &= meta_modifier | ~ - meta_modifier; | 2089 | c &= meta_modifier | ~ - meta_modifier; |
| 2089 | c2 = c & ~(alt_modifier | ctrl_modifier | hyper_modifier | 2090 | c2 = c & ~(alt_modifier | ctrl_modifier | hyper_modifier |
| 2090 | | meta_modifier | shift_modifier | super_modifier); | 2091 | | meta_modifier | shift_modifier | super_modifier); |
| 2091 | 2092 | ||
| 2093 | valid_p = SINGLE_BYTE_CHAR_P (c2) || char_valid_p (c2, 0); | ||
| 2094 | if (! valid_p) | ||
| 2095 | { | ||
| 2096 | /* KEY_DESCRIPTION_SIZE is large enough for this. */ | ||
| 2097 | p += sprintf (p, "[%d]", c); | ||
| 2098 | return p; | ||
| 2099 | } | ||
| 2100 | |||
| 2092 | if (c & alt_modifier) | 2101 | if (c & alt_modifier) |
| 2093 | { | 2102 | { |
| 2094 | *p++ = 'A'; | 2103 | *p++ = 'A'; |
| @@ -2176,16 +2185,13 @@ push_key_description (c, p, force_multibyte) | |||
| 2176 | } | 2185 | } |
| 2177 | else | 2186 | else |
| 2178 | { | 2187 | { |
| 2179 | int valid_p = SINGLE_BYTE_CHAR_P (c) || char_valid_p (c, 0); | 2188 | if (force_multibyte) |
| 2180 | |||
| 2181 | if (force_multibyte && valid_p) | ||
| 2182 | { | 2189 | { |
| 2183 | if (SINGLE_BYTE_CHAR_P (c)) | 2190 | if (SINGLE_BYTE_CHAR_P (c)) |
| 2184 | c = unibyte_char_to_multibyte (c); | 2191 | c = unibyte_char_to_multibyte (c); |
| 2185 | p += CHAR_STRING (c, p); | 2192 | p += CHAR_STRING (c, p); |
| 2186 | } | 2193 | } |
| 2187 | else if (NILP (current_buffer->enable_multibyte_characters) | 2194 | else if (NILP (current_buffer->enable_multibyte_characters)) |
| 2188 | || valid_p) | ||
| 2189 | { | 2195 | { |
| 2190 | int bit_offset; | 2196 | int bit_offset; |
| 2191 | *p++ = '\\'; | 2197 | *p++ = '\\'; |