aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2017-10-12 23:38:48 +0300
committerEli Zaretskii2017-10-12 23:38:48 +0300
commit59b5dc60d660f81f8b781068d13727ed812ad555 (patch)
tree99fb96a38089644d9325ed547a3439e481fe08bf /src
parent2f4bd2fbdaccbaa61fe9b5adb56ba9e8f3d49505 (diff)
downloademacs-59b5dc60d660f81f8b781068d13727ed812ad555.tar.gz
emacs-59b5dc60d660f81f8b781068d13727ed812ad555.zip
Fix this-command-keys for "M-x foo" commands
* src/keyboard.c (Fset__this_command_keys): Don't assume KEYS is a unibyte string. (Bug#28798)
Diffstat (limited to 'src')
-rw-r--r--src/keyboard.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/keyboard.c b/src/keyboard.c
index ee353d2b078..7ddd6b96747 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -10055,7 +10055,12 @@ Internal use only. */)
10055 10055
10056 this_command_key_count = 0; 10056 this_command_key_count = 0;
10057 this_single_command_key_start = 0; 10057 this_single_command_key_start = 0;
10058 int key0 = SREF (keys, 0); 10058
10059 int charidx = 0, byteidx = 0;
10060 int key0;
10061 FETCH_STRING_CHAR_ADVANCE (key0, keys, charidx, byteidx);
10062 if (CHAR_BYTE8_P (key0))
10063 key0 = CHAR_TO_BYTE8 (key0);
10059 10064
10060 /* Kludge alert: this makes M-x be in the form expected by 10065 /* Kludge alert: this makes M-x be in the form expected by
10061 novice.el. (248 is \370, a.k.a. "Meta-x".) Any better ideas? */ 10066 novice.el. (248 is \370, a.k.a. "Meta-x".) Any better ideas? */
@@ -10064,7 +10069,13 @@ Internal use only. */)
10064 else 10069 else
10065 add_command_key (make_number (key0)); 10070 add_command_key (make_number (key0));
10066 for (ptrdiff_t i = 1; i < SCHARS (keys); i++) 10071 for (ptrdiff_t i = 1; i < SCHARS (keys); i++)
10067 add_command_key (make_number (SREF (keys, i))); 10072 {
10073 int key_i;
10074 FETCH_STRING_CHAR_ADVANCE (key_i, keys, charidx, byteidx);
10075 if (CHAR_BYTE8_P (key_i))
10076 key_i = CHAR_TO_BYTE8 (key_i);
10077 add_command_key (make_number (key_i));
10078 }
10068 return Qnil; 10079 return Qnil;
10069} 10080}
10070 10081