Newsgroups: comp.sys.sgi Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!psuvax1!ukma!usenet.ins.cwru.edu!eagle!data.nas.nasa.gov!nameserver.nas.nasa.gov!browning From: browning@nas.nasa.gov (David S. Browning) Subject: Re: Modification of keyboard code sequences References: <1991Apr12.043331.29665@nas.nasa.gov> Date: 20 Apr 91 00:44:06 Organization: NAS Program, NASA Ames Research Center, Moffett Field, CA Sender: news@nas.nasa.gov In-Reply-To: browning@nas.nasa.gov's message of Fri, 12 Apr 91 04:33:31 GMT Message-ID: Lines: 76 In article <1991Apr12.043331.29665@nas.nasa.gov> browning@nas.nasa.gov (David S. Browning) writes: I want to be able to modify the code sequences generated by the IRIS-4D series keyboard. I have a 4D/60 running IRIX 3.3.1, using the 4Sight NeWS server (i.e. not X windows). My manual is a little old, Version 3.0. In the 4Sight Programmer's Guide, Section 1: Using the GL/DGL Interfaces, Appendix A.2, Table A-3 lists the code sequences generated for all the keys when combined with shift, ctrl and alt. I want to disable the ANSI CSI ("ESC [") escape sequences. I'll post what I've learned so far. Mark_Israel@mts.ucs.ualberta.ca helped me with elisp code that traps the CSI sequences from within emacs. I mapped M-[ to a new function which reads the rest of the CSI sequence. I had to remap backward-paragraph since that used M-[, and I remapped forward-paragraph as well so the two commands would stay together. The following goes in .emacs: --------------------------------------------------------------- ;; These were originally M-[ and M-], but I want M-[ to trap CSI. (global-set-key "\M-{" 'backward-paragraph) (global-set-key "\M-}" 'forward-paragraph) (defun csi-trap () "Trap CSI escape sequences from SGI Iris keyboard" (interactive) (setq c (read-char)) (cond ((= c ?C) (forward-char 1)) ((= c ?D) (backward-char 1)) ((= c ?A) (previous-line 1)) ((= c ?B) (next-line 1)) ((= c ?0) (progn (setq c (read-char)) (setq c (read-char)) (setq c (read-char)) (ding))) ((= c ?1) (progn (setq c (read-char)) (setq c (read-char)) (setq c (read-char)) (ding))) ((= c ?2) (progn (setq c (read-char)) (setq c (read-char)) (setq c (read-char)) (ding))))) (global-set-key "\M-[" 'csi-trap) ----------------------------------------------------------- The trapped CSI sequence beeps, unless it's one of the 4 arrow keys, in which case it takes the appropriate action. At the wsh level, bindkey(1) redefines a few of the function keys, and these override the CSI sequences, even when combined with CTRL, ALT, etc. Once bindkey redefines them, they can't be trapped from within emacs (at least not with csi-trap). David -- |============================================================================| | Internet: browning@nas.nasa.gov Phone: (415) 604-4321 | | UUCP: {hplabs, mailrus, ucbvax, etc.}!ames!amelia!browning | |----------------------------------------------------------------------------| |"the nice thing about true hopelessness is that you don't have to try again"| | -- jules shear | |============================================================================|