Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watnot!watmath!clyde!rutgers!ames!ucbcad!ucbvax!ALEXANDER.BBN.COM!jr From: jr@ALEXANDER.BBN.COM.UUCP Newsgroups: comp.emacs Subject: Re: Mapping wierd function keys with GNU Message-ID: <8702241555.AA06730@ucbvax.Berkeley.EDU> Date: Tue, 24-Feb-87 10:55:46 EST Article-I.D.: ucbvax.8702241555.AA06730 Posted: Tue Feb 24 10:55:46 1987 Date-Received: Fri, 27-Feb-87 00:08:53 EST References: <4171@sdcrdcf.UUCP> Sender: daemon@ucbvax.BERKELEY.EDU Distribution: world Organization: The ARPA Internet Lines: 38 I came across the same thing when writing the code to handle BBN bitgraph mice. The bitgraph sends ANSI-standard (definitely NOT wierd, in fact) sequences, which are a generalization of the VT220's sequences: `ESC' `[' { `;'}* {} and similar ones with `:' substituted for `['. The 's are decimal numbers (maybe signed?) using the digits 0-9. I had to write a parser (it's in bg-mouse.el if you're interested). I think the best approach to this is to put in a mode for (interactive) which says "parse typed arguments according to ANSI conventions, then dispatch on the first non-numeric and non-`;' character". The arguments would be assigned to the formal parameters of the called function. The dispatch would be through an auxilliary keymap (similar to ESC-keymap) included for this purpose. Maybe the way to do it is to have two kinds of keymaps, one which invokes the ANSI parsing; this type would be bound to ESC-[ and ESC-:. Maybe it is sufficient to have a global ANSI-parsing mode which can be turned on based on terminal type. Or maybe the way to do it is to assign a special meaning to numbers and `;' in the ESC-[ keymap which says "keep parsing numbers but stick to this keymap;" the numbers could be cons'ed together into a list for later use in (interactive). I didn't have the heart to attack the source changes, so there it stands, but I think this could be a useful addition to GNU emacs. Feel free to pick up the code in bg-mouse.el and re-use it (in the FSF spirit of course!); maybe a general package to handle VT220 function keys and friends would be considered useful. Notice that this ANSI mechanism is in fact a pretty general remote procedure call mechanism, and could be used to do pretty fancy things in a programmable terminal (and was in the Bitgraph). /jr jr@bbn.com or jr@bbnccv.uucp Without life, there wouldn't be chemical companies.