[comp.emacs] EMACS customization

miller2@flora.mmwb.ucsf.edu (Susan miller2%Cohen) (04/12/90)

Can someone tell me how to customize the EMACS editor for use with a Silicon
Graphics IRIS workstation? I would like to be able to use the function keys
at the top and the arrow keys particularly, but also other keys on the 
keyboard which have no printed value. At the moment I'm getting an error
message about the key codes I'm using (down arrow for instance is ^[[A if 
one can believe the quoted-insert response but this code gives problems in
fact).

Susan Miller

jlange@oracle.com (J Lange) (04/13/90)

Although I don't know anything about the IRIS workstation or its terminal 
emulation features, I may be able to help.  You have determined that down 
arrow sends ^[[A which is the same as ESC [ A.  This is a normal ANSI escape 
sequence, but ESC [ is the default binding for an emacs command 
(backward-paragraph), so it must be disabled first.  This is done with the 
command:
	(global-unset-key "\e[")           [in your .emacs file]
 
Then you can bind any keys that begin with ESC [ (most function keys) to other
functions.  This is easy to do interactively using M-x global-set-key RET.
This is also a good way to determine what sequence a key sends and if it can
be assigned a function.   For example, before doing the global-unset-key
command above, using global-set-key with the down arrow would produce results
like this:

you  ->	M-x global-set-key RET 
emacs-> Set key globally:
you  ->	(press down arrow)
emacs-> Set key ESC [ to command: A

After the global-unset-key the last line would read:

	Set key ESC [ A to command:

To which you would then enter 'next-line'.

Emacs provides a nice generic way of mapping common function keys that is
described in the file keypad.el (usually in /usr/local/emacs/lisp).

I hope this helps.

Jim Lange
jlange@oracle.com
uunet!oracle!jlange
(I'm new to usenet and don't have a fancy signature yet)