aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenichi Handa2006-05-09 13:17:24 +0000
committerKenichi Handa2006-05-09 13:17:24 +0000
commitf39a0b4301f5c1c5902b35ae9eb2f9f051da4bf0 (patch)
tree6beeea763d6e5973006f425257ff3e73bf7d9a87 /src
parentc0b87c3fdb5d85a5dd5393be2d7c00afa20b810b (diff)
downloademacs-f39a0b4301f5c1c5902b35ae9eb2f9f051da4bf0.tar.gz
emacs-f39a0b4301f5c1c5902b35ae9eb2f9f051da4bf0.zip
(push_key_description): Handle invalid character key.
Diffstat (limited to 'src')
-rw-r--r--src/keymap.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/keymap.c b/src/keymap.c
index 4f8343bf5cf..a9669780830 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -2090,12 +2090,21 @@ push_key_description (c, p, force_multibyte)
2090 int force_multibyte; 2090 int force_multibyte;
2091{ 2091{
2092 unsigned c2; 2092 unsigned c2;
2093 int valid_p;
2093 2094
2094 /* Clear all the meaningless bits above the meta bit. */ 2095 /* Clear all the meaningless bits above the meta bit. */
2095 c &= meta_modifier | ~ - meta_modifier; 2096 c &= meta_modifier | ~ - meta_modifier;
2096 c2 = c & ~(alt_modifier | ctrl_modifier | hyper_modifier 2097 c2 = c & ~(alt_modifier | ctrl_modifier | hyper_modifier
2097 | meta_modifier | shift_modifier | super_modifier); 2098 | meta_modifier | shift_modifier | super_modifier);
2098 2099
2100 valid_p = SINGLE_BYTE_CHAR_P (c) || char_valid_p (c, 0);
2101 if (! valid_p)
2102 {
2103 /* KEY_DESCRIPTION_SIZE is large enough for this. */
2104 p += sprintf (p, "[%d]", c);
2105 return p;
2106 }
2107
2099 if (c & alt_modifier) 2108 if (c & alt_modifier)
2100 { 2109 {
2101 *p++ = 'A'; 2110 *p++ = 'A';
@@ -2183,16 +2192,13 @@ push_key_description (c, p, force_multibyte)
2183 } 2192 }
2184 else 2193 else
2185 { 2194 {
2186 int valid_p = SINGLE_BYTE_CHAR_P (c) || char_valid_p (c, 0); 2195 if (force_multibyte)
2187
2188 if (force_multibyte && valid_p)
2189 { 2196 {
2190 if (SINGLE_BYTE_CHAR_P (c)) 2197 if (SINGLE_BYTE_CHAR_P (c))
2191 c = unibyte_char_to_multibyte (c); 2198 c = unibyte_char_to_multibyte (c);
2192 p += CHAR_STRING (c, p); 2199 p += CHAR_STRING (c, p);
2193 } 2200 }
2194 else if (NILP (current_buffer->enable_multibyte_characters) 2201 else if (NILP (current_buffer->enable_multibyte_characters))
2195 || valid_p)
2196 { 2202 {
2197 int bit_offset; 2203 int bit_offset;
2198 *p++ = '\\'; 2204 *p++ = '\\';