Function: recent-keys
recent-keys is a function defined in keyboard.c.
Signature
(recent-keys &optional INCLUDE-CMDS)
Documentation
Return vector of last few events, not counting those from keyboard macros.
If INCLUDE-CMDS is non-nil, include the commands that were run, represented as pseudo-events of the form (nil . COMMAND).
Probably introduced at or before Emacs version 21.1.
Source Code
// Defined in /usr/src/emacs/src/keyboard.c
{
bool cmds = !NILP (include_cmds);
if (!total_keys
|| (cmds && total_keys < lossage_limit))
return Fvector (total_keys,
XVECTOR (recent_keys)->contents);
else
{
Lisp_Object es = Qnil;
int i = (total_keys < lossage_limit
? 0 : recent_keys_index);
eassert (recent_keys_index < lossage_limit);
do
{
Lisp_Object e = AREF (recent_keys, i);
if (cmds || !CONSP (e) || !NILP (XCAR (e)))
es = Fcons (e, es);
if (++i >= lossage_limit)
i = 0;
} while (i != recent_keys_index);
es = Fnreverse (es);
return Fvconcat (1, &es);
}
}