Commit 76b47cc3 authored by Eli Zaretskii's avatar Eli Zaretskii

(Backspace invokes help): Clarify that keyboard-translate is better

than global-set-key.  Add reference to the manual's section about DEL vs
BS.  Mention normal-erase-is-backspace.
parent d0100d57
......@@ -4631,6 +4631,7 @@ actually behaves.
@section Why does the @key{Backspace} key invoke help?
@cindex Backspace key invokes help
@cindex Help invoked by Backspace
@cindex DEL key does not delete
The @key{Backspace} key (on most keyboards) generates ASCII code 8.
@kbd{C-h} sends the same code. In Emacs by default @kbd{C-h} invokes
......@@ -4660,22 +4661,45 @@ keyboard or because they don't even have a separate @key{Delete} key.
In this case, the @key{Backspace} key should be made to behave like
@key{Delete}. There are several methods.
@itemize @minus
@item
Some terminals (e.g., VT3## terminals) and terminal emulators (e.g.,
TeraTerm) allow the character generated by the @key{Backspace} key to be
changed from a setup menu.
@item
Some terminals (e.g., VT3## terminals) allow the character generated
by the @key{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.
@item
You may be able to get a keyboard that is completely programmable.
With Emacs 21.1 and later, you can control the effect of the
@key{Backspace} and @key{Delete} keys, on both dumb terminals and a
windowed displays, by customizing the option
@code{normal-erase-is-backspace-mode}, or by invoking @kbd{M-x
normal-erase-is-backspace}. See the documentation of these symbols
(@pxref{Emacs Lisp documentation}) for more info.
@item
Under X or on a dumb terminal, it is possible to swap the
@key{Backspace} and @key{Delete} keys inside Emacs:
It is possible to swap the @key{Backspace} and @key{DEL} keys inside
Emacs:
@lisp
(keyboard-translate ?\C-h ?\C-?)
@end lisp
@xref{Swapping keys}, for further details of "keyboard-translate".
@noindent
This is the recommended method of forcing @key{Backspace} to act as
@key{DEL}, because it works even in modes which bind @key{DEL} to
something other than @code{delete-backward-char}.
Similarly, you could remap @key{DEL} to act as @kbd{C-d}, which by
default deletes forward:
@lisp
(keyboard-translate ?\C-? ?\C-d)
@end lisp
@xref{Swapping keys}, for further details about @code{keyboard-translate}.
@item
Another approach is to switch key bindings and put help on @kbd{C-x h}
......@@ -4688,7 +4712,16 @@ instead:
(global-set-key "\C-xh" 'help-command)
@end lisp
@noindent
This method is not recommended, though: it only solves the problem for
those modes which bind @key{DEL} to @code{delete-backward-char}. Modes
which bind @key{DEL} to something else, such as @code{view-mode}, will
not work as you expect when you press the @key{Backspace} key. For this
reason, we recommend the the @code{keyboard-translate} method, shown
above.
Other popular key bindings for help are @kbd{M-?} and @kbd{C-x ?}.
@end itemize
Don't try to bind @key{DEL} to @code{help-command}, because there are
many modes that have local bindings of @key{DEL} that will interfere.
......@@ -4699,6 +4732,10 @@ When Emacs 21 or later runs on a windowed display, it binds the
@key{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 @ref{DEL
Does Not Delete, , If @key{DEL} Fails to Delete, emacs, The GNU Emacs
Manual}.
@node stty and Backspace key, Swapping keys, Backspace invokes help, Key bindings
@section Why doesn't Emacs look at the @file{stty} settings for @key{Backspace} vs. @key{Delete}?
@cindex @file{stty} and Emacs
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment