Mercurial > emacs
changeset 39502:c41e104c3131
(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.
author | Eli Zaretskii <eliz@gnu.org> |
---|---|
date | Sun, 30 Sep 2001 07:00:25 +0000 |
parents | dc0beaa136f2 |
children | dd3ea41ff0f7 |
files | man/faq.texi |
diffstat | 1 files changed, 43 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/man/faq.texi Sat Sep 29 18:41:36 2001 +0000 +++ b/man/faq.texi Sun Sep 30 07:00:25 2001 +0000 @@ -4631,6 +4631,7 @@ @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 @@ 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) allow the character generated -by the @key{Backspace} key to be changed from a setup menu. +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 +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 @@ (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 @@ @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