Function: event-convert-list
event-convert-list is a function defined in keyboard.c.
Signature
(event-convert-list EVENT-DESC)
Documentation
Convert the event description list EVENT-DESC to an event type.
EVENT-DESC should contain one base event type (a character or symbol) and zero or more modifier names (control, meta, hyper, super, shift, alt, drag, down, double or triple). The base must be last.
The return value is an event type (a character or symbol) which has
essentially the same base event type and all the specified modifiers.
(Some compatibility base types, like symbols that represent a
character, are not returned verbatim.)
Probably introduced at or before Emacs version 19.29.
Source Code
// Defined in /usr/src/emacs/src/keyboard.c
{
Lisp_Object base = Qnil;
int modifiers = 0;
FOR_EACH_TAIL_SAFE (event_desc)
{
Lisp_Object elt = XCAR (event_desc);
int this = 0;
/* Given a symbol, see if it is a modifier name. */
if (SYMBOLP (elt) && CONSP (XCDR (event_desc)))
this = parse_solitary_modifier (elt);
if (this != 0)
modifiers |= this;
else if (!NILP (base))
error ("Two bases given in one event");
else
base = elt;
}
/* Let the symbol A refer to the character A. */
if (SYMBOLP (base) && SCHARS (SYMBOL_NAME (base)) == 1)
XSETINT (base, SREF (SYMBOL_NAME (base), 0));
if (FIXNUMP (base))
{
/* Turn (shift a) into A. */
if ((modifiers & shift_modifier) != 0
&& (XFIXNUM (base) >= 'a' && XFIXNUM (base) <= 'z'))
{
XSETINT (base, XFIXNUM (base) - ('a' - 'A'));
modifiers &= ~shift_modifier;
}
/* Turn (control a) into C-a. */
if (modifiers & ctrl_modifier)
return make_fixnum ((modifiers & ~ctrl_modifier)
| make_ctrl_char (XFIXNUM (base)));
else
return make_fixnum (modifiers | XFIXNUM (base));
}
else if (SYMBOLP (base))
return apply_modifiers (modifiers, base);
else
error ("Invalid base event");
}