hakimian@tek4.wsu.edu (Karl Hakimian - staff) (03/27/91)
To re-map the numeric keypad from numbers to escape sequences, would you do it in the a: client b: window manager c: server d: all of the above e: none of the above f: a and b g: b and c h: a and c I think the answer is f. This leaves me with a problem. I want to re-map emacs' X window to accept escape sequences from the numeric keypad. Emacs does not have any resources to re-map keys. I am using twm and I can only may keys to functions (no of which send characters to the window) and I can't figure out how to map keys in only some windows and not in all of them. I am running emacs on several machines so I am looking for a solution that is portable. Does anybody have any ideas? Thanks. Karl Hakimian hakimian@yoda.eecs.wsu.edu
mouse@lightning.mcrcim.mcgill.EDU (der Mouse) (03/27/91)
> To re-map the numeric keypad from numbers to escape sequences, would > you do it in the > a: client > b: window manager > c: server > d: all of the above > e: none of the above > f: a and b > g: b and c > h: a and c Technically, the answer is a. The client has to be convinced to re-interpret the KeyPress event for the desired keycode as corresponding to a whole string of characters instead of what it normally would be. Many clients (those based on Xt, typically) have a Translations resource you can set which controls this; you could do something like fooclient*Translations: \ <Key>KP_0: string(0x1b) string("KP0") which would (if I have the syntax right - I never use this mechanism) cause the keypad 0 key to turn into the string ESC K P 0 (ESC is 0x1b). If you put such a resource in the resource manager, the server is involved in that it stores the RESOURCE_MANAGER property, but that hardly counts. I don't know what your variant of emacs (you don't say what emacs you're using) does for this, so I can't offer specific advice. If the translations mechanism doesn't work, I'd have to start reading documentation, or if you have source poking around in it. der Mouse old: mcgill-vision!mouse new: mouse@larry.mcrcim.mcgill.edu
dce@smsc.sony.com (David Elliott) (03/28/91)
In article <9103270712.AA09645@lightning.McRCIM.McGill.EDU> mouse@lightning.mcrcim.mcgill.EDU (der Mouse) writes: >Many clients (those based on Xt, typically) have a Translations >resource you can set which controls this; you could do something like > > fooclient*Translations: \ > <Key>KP_0: string(0x1b) string("KP0") > >which would (if I have the syntax right - I never use this mechanism) >cause the keypad 0 key to turn into the string ESC K P 0 (ESC is 0x1b). Note that the "string" part is xterm-specific, and each client will be different. In fact, I don't know of any other client that uses "string", though the Athena Text widgets have an insert-string. The "string" is called an "action", and must be registered by the client. Mostly, the widgets register their actions (most Text widgets have a lot of actions for editing). Enterprising programmers will also add actions of their own for higher-level functions, especially in cases where menus can be unweildy. Some widget sets, notably OSF/Motif, force certain restrictions on translations. For example, the F4 and F10 keys on my system can not be remapped within a Motif-based application without modifying the user's Motif bindings file. Thus, the recently-created xterm with Motif scrollbars and menus (found on export) doesn't work for me like the MIT xterm.