Lisp_Object this_command_keys;
int this_command_key_count;
+/* Number of elements of this_command_keys
+ that precede this key sequence. */
+int this_single_command_key_start;
+
/* Record values of this_command_key_count and echo_length ()
before this command was read. */
static int before_command_key_count;
if (before_command_restore_flag)
{
this_command_key_count = before_command_key_count_1;
+ if (this_command_key_count < this_single_command_key_start)
+ this_single_command_key_start = this_command_key_count;
echo_truncate (before_command_echo_length_1);
before_command_restore_flag = 0;
}
nonundocount = 0;
no_redisplay = 0;
this_command_key_count = 0;
+ this_single_command_key_start = 0;
/* Make sure this hook runs after commands that get errors and
throw to top level. */
{
cancel_echoing ();
this_command_key_count = 0;
+ this_single_command_key_start = 0;
goto finalize;
}
current_kboard->Vlast_command = this_command;
cancel_echoing ();
this_command_key_count = 0;
+ this_single_command_key_start = 0;
}
if (!NILP (current_buffer->mark_active) && !NILP (Vrun_hooks))
if (INTERACTIVE)
echo_start = echo_length ();
keys_start = this_command_key_count;
+ this_single_command_key_start = keys_start;
#if defined (GOBBLE_FIRST_EVENT)
/* This doesn't quite work, because some of the things that read_char
if (!used_mouse_menu)
last_nonmenu_event = key;
+ /* Record what part of this_command_keys is the current key sequence. */
+ this_single_command_key_start = this_command_key_count - t;
+
prev_fkey_map = fkey_map;
prev_fkey_start = fkey_start;
prev_fkey_end = fkey_end;
(To ignore it safely, we would need to gcpro a bunch of
other variables.) */
if (! (VECTORP (fkey_next) || STRINGP (fkey_next)))
- error ("Function in function-key-map returns invalid key sequence");
+ error ("Function in key-translation-map returns invalid key sequence");
}
function_key_possible = ! NILP (fkey_next);
gcpro1.nvars = (sizeof keybuf/sizeof (keybuf[0]));
if (NILP (continue_echo))
- this_command_key_count = 0;
+ {
+ this_command_key_count = 0;
+ this_single_command_key_start = 0;
+ }
i = read_key_sequence (keybuf, (sizeof keybuf/sizeof (keybuf[0])),
prompt, ! NILP (dont_downcase_last),
means unconditionally put this command in `command-history'.\n\
Otherwise, that is done only if an arg is read using the minibuffer.\n\
The argument KEYS specifies the value to use instead of (this-command-keys)\n\
-when reading the arguments; if it is nil, (this_command_key_count) is used.\n\
+when reading the arguments; if it is nil, (this-command-keys) is used.\n\
The argument SPECIAL, if non-nil, means that this command is executing\n\
a special event, so ignore the prefix argument and don't clear it.")
(cmd, record_flag, keys, special)
Lisp_Object tem;
this_command_key_count = 0;
+ this_single_command_key_start = 0;
keys = XVECTOR (saved_keys)->contents;
for (i = 0; i < XVECTOR (saved_keys)->size; i++)
XVECTOR (this_command_keys)->contents);
}
+DEFUN ("this-single-command-keys", Fthis_single_command_keys,
+ Sthis_single_command_keys, 0, 0, 0,
+ "Return the key sequence that invoked this command.\n\
+Unlike `this-command-keys', this function's value\n\
+does not include prefix arguments.\n\
+The value is a string or a vector.")
+ ()
+{
+ return make_event_array (this_command_key_count
+ - this_single_command_key_start,
+ (XVECTOR (this_command_keys)->contents
+ + this_single_command_key_start));
+}
+
DEFUN ("reset-this-command-lengths", Freset_this_command_lengths,
Sreset_this_command_lengths, 0, 0, 0,
"Used for complicated reasons in `universal-argument-other-key'.\n\
defsubr (&Scommand_execute);
defsubr (&Srecent_keys);
defsubr (&Sthis_command_keys);
+ defsubr (&Sthis_single_command_keys);
defsubr (&Sreset_this_command_lengths);
defsubr (&Ssuspend_emacs);
defsubr (&Sabort_recursive_edit);