Function: self-insert-command

self-insert-command is an interactive function defined in cmds.c.

Signature

(self-insert-command N &optional C)

Documentation

Insert the character you type.

Whichever character C you type to run this command is inserted. The numeric prefix argument N says how many times to repeat the insertion. Before insertion, expand-abbrev is executed if the inserted character does not have word syntax and the previous character in the buffer does. After insertion, internal-auto-fill is called if auto-fill-function(var)/auto-fill-function(fun) is non-nil and if the auto-fill-chars table has a non-nil value for the inserted character. At the end, it runs post-self-insert-hook.

View in manual

Probably introduced at or before Emacs version 22.1.

Key Bindings

Aliases

japanese-TeX-self-insert-command

Source Code

// Defined in /usr/src/emacs/src/cmds.c
{
  CHECK_FIXNUM (n);

  /* Backward compatibility.  */
  if (NILP (c))
    c = last_command_event;
  else
    last_command_event = c;

  if (XFIXNUM (n) < 0)
    error ("Negative repetition argument %"pI"d", XFIXNUM (n));

  if (XFIXNAT (n) < 2)
    call0 (Qundo_auto_amalgamate);

  /* Barf if the key that invoked this was not a character.  */
  if (!CHARACTERP (c))
    bitch_at_user ();
  else
    {
      int character = translate_char (Vtranslation_table_for_input,
				      XFIXNUM (c));
      int val = internal_self_insert (character, XFIXNAT (n));
      if (val == 2)
	Fset (Qundo_auto__this_command_amalgamating, Qnil);
      frame_make_pointer_invisible (SELECTED_FRAME ());
    }

  return Qnil;
}