Path: utzoo!utgpu!watserv1!watcgl!andrewt From: andrewt@watnow.waterloo.edu (Andrew Thomas) Newsgroups: comp.sys.amiga Subject: Re: DNET/FTERM and GNU-emacs Message-ID: Date: 29 Mar 90 13:36:12 GMT References: <1990Mar27.153542.2577@iesd.auc.dk> Sender: daemon@watcgl.waterloo.edu Organization: University of Waterloo, Waterloo, Ontario, Canada Lines: 53 In-reply-to: kasper@iesd.auc.dk's message of 27 Mar 90 15:35:42 GMT In article <1990Mar27.153542.2577@iesd.auc.dk> kasper@iesd.auc.dk (Kasper Osterbye) writes: > What I am wondering is, if any one has set up a configuration for GNU-emacs > on the unix-side so that one can use the amiga function keys and cursor > keys? (noone has touched the mouse in connection with DNet yet?) > > Some of the problems I see, is that the function keys sends variable > length characters ended with a "~" character, something that it is not > obvious to me to have emacs handle gracefully. GNU emacs will normally handle multi-character keystrokes. The only limitation on them is that you cannot remap any character sequence for which some part of it, starting at the beginning of the sequence, also has a function. For example, we have a keyboard here which sends the characters ESC F ~ from a function key. In this case, since ESC F also has a meaning, you can't map the function key to anything. You will get the behaviour of ESC F plus a tilde inserted after. The VT220 keyboards here send ESC[227z and ESC[22~ kinds of sequences. These can be mapped by doing: (global-unset-key "\e[") ;; VT100 function keys (global-set-key "\e[A" 'previous-line) (global-set-key "\e[B" 'next-line) (global-set-key "\e[D" 'backward-char) (global-set-key "\e[C" 'forward-char) ;; some SUN console function keys (global-set-key "\e[32~" 'scroll-up) (global-set-key "\e[34~" 'scroll-down) (global-set-key "\e[31~" 'save-buffer) (global-set-key "\e[33~" 'suspend-emacs) ;; more SUN console keys (global-unset-key "\eO") (global-set-key "\eOA" 'previous-line) (global-set-key "\eOB" 'next-line) (global-set-key "\eOD" 'backward-char) (global-set-key "\eOC" 'forward-char) for example. What you have to do is global-unset-key any prefixes to the sequence which might have a meaning, and then simply bind the longer sequences to emacs commands. If you want it to be buffer-local, then use local-unset-key and local-set-key. Note that keys can only be bound to interactive commands (those available using ESC X), so if you write your own, be sure to put (interactive) as the first line in your defun. Hope this helps. -- Andrew Thomas andrewt@watnow.waterloo.edu Systems Design Eng. University of Waterloo "If a million people do a stupid thing, it's still a stupid thing." - Opus