Function: delete-char
delete-char is an interactive function defined in cmds.c.
Signature
(delete-char N &optional KILLFLAG)
Documentation
Delete the following N characters (previous if N is negative).
Optional second arg KILLFLAG non-nil means kill instead (save in kill ring). Interactively, N is the prefix arg, and KILLFLAG is set if N was explicitly specified.
The command delete-forward-char is preferable for interactive use, e.g.
because it respects values of delete-active-region(var)/delete-active-region(fun) and overwrite-mode(var)/overwrite-mode(fun).
Probably introduced at or before Emacs version 20.1.
Key Bindings
Aliases
Source Code
// Defined in /usr/src/emacs/src/cmds.c
{
EMACS_INT pos;
CHECK_FIXNUM (n);
if (eabs (XFIXNUM (n)) < 2)
call0 (Qundo_auto_amalgamate);
pos = PT + XFIXNUM (n);
if (NILP (killflag))
{
if (XFIXNUM (n) < 0)
{
if (pos < BEGV)
xsignal0 (Qbeginning_of_buffer);
else
del_range (pos, PT);
}
else
{
if (pos > ZV)
xsignal0 (Qend_of_buffer);
else
del_range (PT, pos);
}
}
else
{
call1 (Qkill_forward_chars, n);
}
return Qnil;
}