Copyright (C) 2000-2012 |
GNU Info (efaq)Backspace invokes helpWhy 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. This can be solved by making <DEL> the command for deleting the previous character outside of Emacs. On many Unix systems, this command will remap <DEL>: stty erase `^?' * The user may prefer 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) and terminal emulators (e.g., TeraTerm) 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, or a terminal emulator that supports remapping of any key to any other key. - With Emacs 21.1 and later, you can control the effect of the <Backspace> and <Delete> keys, on both dumb terminals and a windowed displays, by customizing the option `normal-erase-is-backspace-mode', or by invoking `M-x normal-erase-is-backspace'. See the documentation of these symbols (Note: Emacs Lisp documentation) for more info. - It is possible to swap the <Backspace> and <DEL> keys inside Emacs: (keyboard-translate ?\C-h ?\C-?) This is the recommended method of forcing <Backspace> to act as <DEL>, because it works even in modes which bind <DEL> to something other than `delete-backward-char'. Similarly, you could remap <DEL> to act as `C-d', which by default deletes forward: (keyboard-translate ?\C-? ?\C-d) Note: Swapping keys, for further details about `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) ;;; overrides mark-whole-buffer (global-set-key "\C-xh" 'help-command) This method is not recommended, though: it only solves the problem for those modes which bind <DEL> to `delete-backward-char'. Modes which bind <DEL> to something else, such as `view-mode', will not work as you expect when you press the <Backspace> key. For this reason, we recommend the the `keyboard-translate' method, shown above. Other popular key bindings for help are `M-?' and `C-x ?'. Don't try to bind <DEL> to `help-command', because there are many modes that have local bindings of <DEL> that will interfere. When Emacs 21 or later runs on a windowed display, it binds the <Delete> key to a command which deletes the character at point, to make Emacs more consistent with keyboard operation on these systems. For more information about troubleshooting this problem, see Note: If <DEL> Fails to Delete. automatically generated by info2www version 1.2.2.9 |