Function: set--this-command-keys

set--this-command-keys is a function defined in keyboard.c.

Signature

(set--this-command-keys KEYS)

Documentation

Set the vector to be returned by this-command-keys.

The argument KEYS must be a string. Internal use only.

Source Code

// Defined in /usr/src/emacs/src/keyboard.c
{
  CHECK_STRING (keys);

  this_command_key_count = 0;
  this_single_command_key_start = 0;

  ptrdiff_t charidx = 0, byteidx = 0;
  int key0 = fetch_string_char_advance (keys, &charidx, &byteidx);
  if (CHAR_BYTE8_P (key0))
    key0 = CHAR_TO_BYTE8 (key0);

  /* Kludge alert: this makes M-x be in the form expected by
     novice.el.  (248 is \370, a.k.a. "Meta-x".)  Any better ideas?  */
  if (key0 == 248)
    add_command_key (make_fixnum ('x' | meta_modifier));
  else
    add_command_key (make_fixnum (key0));
  for (ptrdiff_t i = 1; i < SCHARS (keys); i++)
    {
      int key_i = fetch_string_char_advance (keys, &charidx, &byteidx);
      if (CHAR_BYTE8_P (key_i))
	key_i = CHAR_TO_BYTE8 (key_i);
      add_command_key (make_fixnum (key_i));
    }
  return Qnil;
}