ARCHIVED: In Emacs, why does the Backspace key invoke help?

This content has been archived, and is no longer maintained by Indiana University. Information here may no longer be accurate, and links may no longer be available or reliable.

The Backspace key (on most keyboards) generates ASCII code 8. C-h sends the same code. In Emacs, C-h invokes the Emacs help command by default. This is intended to be easy to remember since the first letter of "help" is "h". One solution to this problem is to use C-h (and Backspace) for help, and Del (the Delete key) for deleting the previous character. In some cases, however, this may be problematic:

  • If you normally use Backspace outside of Emacs for deleting the previous character typed, you can solve this by making Del the command for deleting the previous character outside of Emacs. The following command will do this on many Unix systems:
      stty erase '^?'
  • If you prefer to use the Backspace key for deleting the previous character because it is more conveniently located on the keyboard or because you don't have a separate Del key, you can make the Backspace key behave like Del. Choose one of the following methods:
    • Some terminals (e.g., VT3## terminals) have a setup menu that will allow you to change the character generated by the Backspace key.
    • You may be able to get a keyboard that is completely programmable.
    • Under the X Window System or on a dumb terminal, it is possible to swap the Backspace and Del keys inside Emacs by putting the following line in your .emacs file:
        (keyboard-translate ?\C-h ?\C-?)
    • Another approach is to switch key bindings and put help on C-x h instead, by putting the following lines in your .emacs file:
        (global-set-key [?\C-h] 'delete-backward-char)
        (global-set-key [?\C-x ?h] 'help-command)
                                 ;; overrides mark-whole-buffer

Other popular key bindings for help are M-? and C-x ?.

Note: Don't try to bind Del to the help command, because there are many modes that have local bindings of Del that will interfere.

This information comes from the Emacs FAQ.

At Indiana University, for personal or departmental Linux or Unix systems support, see Get help for Linux or Unix at IU.

Related documents

This is document abvn in the Knowledge Base.
Last modified on 2018-01-18 09:27:28.