boaz@Athena.MIT.EDU (Boaz P Ben-Zvi) (09/22/89)
---------------------- ========================================================== EmacsVersion: 18.54 Machine: uVAX 2 X11 Windows ========================================================== While trying to bind some of my keyboard keys I found that Emacs totaly ignored some of them (e.g. PrevScreen). Remapping (using "xmodmap") to many values (like F21, F22 ...) Reveled a whole range of possible keys that is ignored by Emacs ! Checking the Emacs code (see below) showed that indeed Emacs ignores several keys, some which exist on the uVAX 2 keyboard and some that 1. Emacs ignores several existing keys (e.g. PrevScreen ==> XK_Prior ) 2. Emacs ignores non-existing keys, therefore limits users' ability to remap their keys to non-existing ones (e.g. xmodmap -e "F12 = F33"). Emacs ignores the following existing keys (shown with their X11 default "Remove" (XK_Delete) "PrevScreen" (XK_prior) "NextScreen" (XK_Next) it seems like a bug since the function "char *stringFuncVal(keycode)" does handle these keys, but the X11 library definitions (in <X11/Xutil.h>) of "IsMiscFunctionKey(keysym)" precludes them (See the key codes in /usr/include/X11/keysymdef.h). ======================== -------------------------------- 1140 char *stringFuncVal(keycode) 1141 KeySym keycode; 1142 { 1143 switch (keycode) { 1145 return("11"); ............ 1187 return("34"); 1188 1190 return("1"); 1192 return("2"); >> 1193 case XK_Delete: HERE THE KEYS ARE HANDLED 1194 return("3"); 1196 return("4"); 1198 return("5"); 1200 return("6"); 1202 return("-1"); 1203 } .............................. .................. 1328 if (IsFunctionKey(keysym) || 1329 IsMiscFunctionKey(keysym)) { << HERE THE KEYS ARE IGNORED 1330 strcpy(mapping_buf,"^[["); (SEE BELOW) 1331 strcat(mapping_buf,stringFuncVal(keysym)); .................. 1339 else { 1340 switch (keysym) { 1342 strcpy(mapping_buf,"\002"); 1343 nbytes = 1; 1344 break; 1346 strcpy(mapping_buf,"\006"); 1347 nbytes = 1; 1348 break; 1350 strcpy(mapping_buf,"\020"); 1351 nbytes = 1; 1352 break; 1354 strcpy(mapping_buf,"\016"); 1355 nbytes = 1; 1356 break; 1357 } 1358 } ****** in /usr/include/X11/Xutil.h: #define IsFunctionKey(keysym) \ (((unsigned)(keysym) >= XK_F1) && ((unsigned)(keysym) <= XK_F35)) #define IsMiscFunctionKey(keysym) \ (((unsigned)(keysym) >= XK_Select) && ((unsigned)(keysym) < XK_KP_Space)) THE ABOVE DEFINITION IGNORES THE THREE KEYS, SEE CODES BELOW ****** in /usr/include/X11/keysymdef.h: Here you can see that the ignored keys are out of the range FF60 - FF7F : ------------------------------------------------------------------------- > #define XK_Delete 0xFFFF /* Delete, rubout */ ............ /* Cursor control & motion */ #define XK_Home 0xFF50 #define XK_Left 0xFF51 /* Move left, left arrow */ #define XK_Up 0xFF52 /* Move up, up arrow */ #define XK_Right 0xFF53 /* Move right, right arrow */ #define XK_Down 0xFF54 /* Move down, down arrow */ > #define XK_Prior 0xFF55 /* Prior, previous */ > #define XK_Next 0xFF56 /* Next */ #define XK_End 0xFF57 /* EOL */ #define XK_Begin 0xFF58 /* BOL */ /* Misc Functions */ #define XK_Select 0xFF60 /* Select, mark */ #define XK_Print 0xFF61 #define XK_Execute 0xFF62 /* Execute, run, do */ #define XK_Insert 0xFF63 /* Insert, insert here */ #define XK_Undo 0xFF65 /* Undo, oops */ #define XK_Redo 0xFF66 /* redo, again */ #define XK_Menu 0xFF67 #define XK_Find 0xFF68 /* Find, search */ #define XK_Cancel 0xFF69 /* Cancel, stop, abort, exit */ #define XK_Help 0xFF6A /* Help, ? */ #define XK_Break 0xFF6B #define XK_Mode_switch 0xFF7E /* Character set switch */ #define XK_script_switch 0xFF7E /* Alias for mode_switch */ #define XK_Num_Lock 0xFF7F /* Keypad Functions, keypad numbers cleverly chosen to map to ascii */ #define XK_KP_Space 0xFF80 /* space */
cks@white.toronto.edu (Chris Siebenmann) (09/23/89)
Emacs 18.xx ignores many function keys, and binds the others to inobvious sequences that vary depending on whether Emacs was compiled on a Sun or not. My solution was to rip the code out and substitute a version that used XKeysymToString() to generate codes of the form ESC [ <keysym name or hex value> ~ which are predictable and match the names other X11 things give those keys (notably xev). Since x11term.c has escapes in it, I can't post context diffs; people with anonymous ftp can grab my hacked x11term.c from snow.white.toronto.edu [128.100.2.160], or you can contact me and I'll mail a uuencoded patch. From what I hear, this problem is fixed in version 19. -- "I shall clasp my hands together and bow to the corners of the world." Number Ten Ox, "Bridge of Birds" Chris Siebenmann ...!utgpu!{ncrcan,ontmoh!moore}!ziebmef!cks cks@white.toronto.edu or ...!utgpu!{,csri!}cks