+2011-10-03 Stefan Monnier <monnier@iro.umontreal.ca>
+
+ * keyboard.c (read_key_sequence_remapped): New var.
+ (read_key_sequence): Compute remapping in the right buffer.
+ (command_loop_1): Use read_key_sequence's remapping directly.
+
2011-10-02 Stefan Monnier <monnier@iro.umontreal.ca>
* dired.c (file_name_completion): Don't expand file name.
/* read_key_sequence stores here the command definition of the
key sequence that it reads. */
static Lisp_Object read_key_sequence_cmd;
+static Lisp_Object read_key_sequence_remapped;
static Lisp_Object Qinput_method_function;
reset it before we execute the command. */
Vdeactivate_mark = Qnil;
- /* Remap command through active keymaps */
+ /* Remap command through active keymaps. */
Vthis_original_command = cmd;
- if (SYMBOLP (cmd))
- {
- Lisp_Object cmd1;
- if (cmd1 = Fcommand_remapping (cmd, Qnil, Qnil), !NILP (cmd1))
- cmd = cmd1;
- }
+ if (!NILP (read_key_sequence_remapped))
+ cmd = read_key_sequence_remapped;
/* Execute the command. */
read_key_sequence_cmd = (first_binding < nmaps
? defs[first_binding]
: Qnil);
+ read_key_sequence_remapped
+ /* Remap command through active keymaps.
+ Do the remapping here, before the unbind_to so it uses the keymaps
+ of the appropriate buffer. */
+ = SYMBOLP (read_key_sequence_cmd)
+ ? Fcommand_remapping (read_key_sequence_cmd, Qnil, Qnil)
+ : Qnil;
unread_switch_frame = delayed_switch_frame;
unbind_to (count, Qnil);
read_key_sequence_cmd = Qnil;
staticpro (&read_key_sequence_cmd);
+ read_key_sequence_remapped = Qnil;
+ staticpro (&read_key_sequence_remapped);
menu_bar_one_keymap_changed_items = Qnil;
staticpro (&menu_bar_one_keymap_changed_items);