GNU emacs key remapping
Mike Yang
mikey at eukanuba.wpd.sgi.com
Sun Aug 12 05:01:27 AEST 1990
In article <3517 at leah.Albany.Edu>, bk7295 at leah.Albany.Edu (Brian A.
Kell) writes:
|> I've been trying to remap things in GNU emacs to make my iris
keyboard
|> consistant with the vt100 terminals also used at my location. It's
|> quite easy to redefine the backspace key to actually delete
characters:
|> (define-key global-map "\C-h" 'delete-backward-char)
|> but it's much more difficult to come up with an alternate help
character,
|> such as the delete key (^?). This seems to be because ^h is defined
|> somewhere as a special 'prefix character', similarly to ^x, ^c,
esc-x,
|> etc.
I found that the method you describe for remapping the backspace key to
be "delete" has similar problems -- some modes (e.g. rmail) have
hardcoded
into them "\C-h" in some way.
So, to muck with the interals of gnuemacs and really swap backspace
and delete, I do:
;; Set up keymap so that ^H and delete are swapped
(progn
(setq keyboard-translate-table (make-string 128 0))
(let ((i 0))
(while (< i 128)
(aset keyboard-translate-table i i)
(setq i (1+ i)))))
(aset keyboard-translate-table ?\^h ?\^?)
(aset keyboard-translate-table ?\^? ?\^h)
This works well for gnuemacs run in xterm or wsh windows.
However, it doesn't work correctly for gnuemacs X windows (i.e.
gnuemacs without the -nw switch). I suspect that this is because the
X server is doing something funny with the keyboard mappings, and
xterm is fixing it up.
It doesn't bother me because I always run gnuemacs within shells. If
you don't, omit the last line from above and you'll still remap
backspace to be delete. However, you won't have the help-command key
bound to anything.
-----------------------------------------------------------------------
Mike Yang Silicon Graphics, Inc.
mikey at sgi.com 415/335-1786
More information about the Comp.sys.sgi
mailing list