121: Why does the "Backspace" key invoke help?
The "Backspace" key (on most keyboards) generates ASCII code 8. `C-h'
sends the same code. In Emacs by default `C-h' invokes help-command.
This is intended to be easy to remember since the first letter of "help"
is `h'. The easiest solution to this problem is to use `C-h' (and
Backspace) for help and DEL (the Delete key) for deleting the previous
character.
For many people this solution may be problematic:
* They normally use Backspace outside of Emacs for deleting the previous
character typed. This can be solved by making DEL be the command for
deleting the previous character outside of Emacs. This command will do
this on many Unix systems:
stty erase `^?'
* The person may prefer using the Backspace key for deleting the previous
character because it is more conveniently located on their keyboard or
because they don't even have a separate Delete key. In this case, the
Backspace key should be made to behave like Delete. There are several
methods.
* Some terminals (e.g., VT3## terminals) allow the character generated by
the Backspace key to be changed from a setup menu.
* You may be able to get a keyboard that is completely programmable.
* Under X or on a dumb terminal, it is possible to swap the Backspace and
Delete keys inside Emacs:
(keyboard-translate ?\C-h ?\C-?)
See question 123 for further details of "keyboard-translate".
* Another approach is to switch key bindings and put help on "C-x h"
instead:
(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 help-command, because there are many
modes that have local bindings of DEL that will interfere.