bnm@rosalyn.dms.cdc.COM (Brad Miller) (08/08/90)
I am trying to figure out how to remap the arrow keys so that I can use them with GNU emacs in a wsh window. The problem seems to be that the sequence for up arrow is \e[A however when I try to use (define-key global-map "\e[A" 'previous-line) all I get is Key sequence ^[[A uses invalid prefix characters. This seems like it should work, and the arrow keys do work on the version compiled with the X flags on, but I need to get this so it will work in a wsh window. Any help is greatly appreciated. Please reply to bmiller@shamash.cdc.com thanks. -- |------------------------------------------------------------| | Brad Miller bmiller@shamash.cdc.com | | Advanced Systems Group phone: (612) 553-4473 | | Empros Systems International fax: (612) 553-4018 | | 2300 Berkshire Lane N. | | Plymouth, MN 55441 | | A Division of Control Data Corporation | |------------------------------------------------------------|
hultquis@nas.nasa.gov (Jeff P. M. Hultquist) (08/10/90)
> From: hewey!bnm@rosalyn.dms.cdc.COM (Brad Miller) > Newsgroups: comp.sys.sgi > > I am trying to figure out how to remap the arrow keys so that I > can use them with GNU emacs in a wsh window. The problem seems > to be that the sequence for up arrow is \e[A ... ;;;---------------------------------------- ;;; Mappings of the "extra" keys on the IRIS; some of these keys ;;; do not produce any output. This is probably due to some ;;; calls to 'bindkey()' or 'replacekey' in the standard system ;;; initialization. The most annoying of these is the aliasing ;;; of the keypad's (2468) to be indistinguishable from the arrow ;;; keys. (require 'keypad) (progn (defvar IRIS-map (lookup-key global-map "\e[")) (if (not (keymapp IRIS-map)) (progn (setq IRIS-map (make-sparse-keymap)) (global-set-key "\e[" IRIS-map))) (setup-terminal-keymap IRIS-map '(;; ("001q" . upcase-word) ; F1 ("002q" . nil) ; F2 ; ("003q" . nil) ; F3 ; ("004q" . nil) ; F4 ("005q" . nil) ; F5 ("006q" . nil) ; F6 ("007q" . nil) ; F7 ("008q" . nil) ; F8 ("009q" . nil) ; F9 ("010q" . nil) ; F10 ("011q" . nil) ; F11 ("012q" . nil) ; F12 ;; ("139q" . nil) ; 0 ("146q" . nil) ; 1 ("154q" . nil) ; 3 ("000q" . nil) ; 5 ("H" . beginning-of-buffer) ; 7 ("150q" . nil) ; 9 ;; ;; ("B" . nil) ; 2 ;; ("D" . nil) ; 4 ;; ("C" . nil) ; 6 ;; ("A" . nil) ; 8 ;; ("A" . previous-line) ; up ("B" . next-line) ; down ("C" . forward-char) ; right ("D" . backward-char) ; left ;; ("139q" . nil) ; insert ("209q" . nil) ; print-screen ("213q" . nil) ; scroll-lock ("217q" . nil) ; pause )) 'done) ;;;---------------------------------------- -- -- Jeff Hultquist hultquis@nas.nasa.gov NASA - Ames Research Center (415) 604-4970 Disclaimer: "I am not a rocket scientist."
bk7295@leah.Albany.Edu (Brian A. Kell) (08/11/90)
While we're on the subject of GNU emacs key mapping, I've been having another problem with the iris keyboard. Iris uses ctrl-h as the backspace character, but does not use the delete key (DEL or ctrl-?). This is just the opposite of many other teminals, notable DEC's vt series. I can handle this as far as rlogin'ing to other machines, but it butts head-on against Richard Stallman's choice of ^h as the help character. 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. So, how does one go about changing the help-prefix key from ^h to something else (like ^?) ? I've tried a lot of things, with only partial success. I would like to so this in a terminal-specific manner (i.e. in a file called `iris.el') so that vt100 users are not effected. I'm using GNU emacs 18.55 Thanks in advance for any help that I might get. I'll post a summary if I get anything. Brian A. Kell SUNY/Albany Department of Computer Science brian@isadora.albany.edu or bk7295@leah.albany.edu
mikey@eukanuba.wpd.sgi.com (Mike Yang) (08/12/90)
In article <3517@leah.Albany.Edu>, bk7295@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@sgi.com 415/335-1786