Every keyboard has a large key, usually labeled
BACKSPACE, which is ordinarily used to erase the last character that you typed. In Emacs, this key is supposed to be equivalent to
When Emacs starts up on a graphical display, it determines automatically which key should be
DEL. In some unusual cases, Emacs gets the wrong information from the system, and
BACKSPACE ends up deleting forwards instead of backwards.
Some keyboards also have a
Delete key, which is ordinarily used to delete forwards. If this key deletes backward in Emacs, that too suggests Emacs got the wrong information—but in the opposite sense.
On a text terminal, if you find that
BACKSPACE prompts for a Help command, like
Control-h, instead of deleting a character, it means that key is actually sending the ‘
BS’ character. Emacs ought to be treating
DEL, but it isn’t.
In all of those cases, the immediate remedy is the same: use the command
M-x normal-erase-is-backspace-mode. This toggles between the two modes that Emacs supports for handling
DEL, so if Emacs starts in the wrong mode, this should switch to the right mode. On a text terminal, if you want to ask for help when
BS is treated as
F1 instead of
C-? may also work, if it sends character code 127.
To fix the problem in every Emacs session, put one of the following lines into your initialization file (see Init File). For the first case above, where
BACKSPACE deletes forwards instead of backwards, use this line to make
BACKSPACE act as
For the other two cases, use this line:
Another way to fix the problem for every Emacs session is to customize the variable
normal-erase-is-backspace: the value
t specifies the mode where
nil specifies the other mode. See Easy Customization.