home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / languages / elisp / misc / lk201-X.shar < prev    next >
Encoding:
Internet Message Format  |  1990-07-22  |  6.2 KB

  1. From: jv@mhres.mh.nl (Johan Vromans)
  2. Newsgroups: gnu.emacs,comp.emacs
  3. Subject: LK201 support for X11 Emacs (here it is)
  4. Message-ID: <3497@mhres.mh.nl>
  5. Date: 30 Aug 89 18:55:38 GMT
  6. Organization: Multihouse NV, the Netherlands
  7. Lines: 292
  8.  
  9. Within a few hours after posting my offer to share the LK201
  10. enhancements I was almost overwhelmed with requests, so here it is.
  11. (I hope I didn't promise too much ... :-).
  12.  
  13. The following shar contains two files: "keymap" and
  14. "x11term.c.LK201.diffs". 
  15.  
  16. I use "xmodmap keymap" to get my Escape, Tilde, Backquote
  17. and Greater/Less keys right; they affect all applications. 
  18. As you can see, I use Shift/Escape for tilde, but that is a matter of
  19. personal taste.
  20.  
  21. Look Out! If you use DECterm and remap your keyboard using the
  22. Configure Keyboard menu, the new settings will conflict with the old
  23. ones. Apparently DECterm maps *KeySyms*, not *KeyCodes*. 
  24.  
  25. Apply the diffs to your current Emacs 18.55 distribution, and
  26. recompile. You will need to include -DLK201 in your CFLAGS to
  27. have the changes compiled.
  28.  
  29. #---------------- cut here ----------------
  30. #!/bin/sh
  31. #
  32. # This is a shell archive.  Remove anything before this line,
  33. # then unpack it by saving it in a file and typing "sh file".
  34. #
  35. # Wrapped by Johan Vromans <jv@mhres> on Wed Aug 30 20:47:17 1989
  36. #
  37. # This archive contains:
  38. #    keymap            x11term.c.LK201.diffs    
  39. #
  40.  
  41. LANG=""; export LANG
  42.  
  43. echo x - keymap
  44. cat >keymap <<'@EOF'
  45. ! make sure the common functions work
  46. keycode 113 = F11
  47. ! [~`] -> ESC and ~
  48. keycode 191 = Escape asciitilde
  49. ! [<>] -> [`~]
  50. keycode 201 = quoteleft asciitilde
  51. ! [,,] -> [,<]
  52. keycode 232 = comma less
  53. ! [..] -> [.>]
  54. keycode 237 = period greater
  55. @EOF
  56.  
  57. chmod 644 keymap
  58.  
  59. echo x - x11term.c.LK201.diffs
  60. cat >x11term.c.LK201.diffs <<'@EOF'
  61. *** ORGx11term.c    Fri Aug 25 08:36:51 1989
  62. --- x11term.c    Tue Aug 29 13:11:04 1989
  63. ***************
  64. *** 1200,1205
  65.           return("2");
  66.       case XK_Delete:
  67.           return("3");
  68.       case XK_Select:
  69.           return("4");
  70.       case XK_Prior:
  71.  
  72. --- 1200,1206 -----
  73.           return("2");
  74.       case XK_Delete:
  75.           return("3");
  76. + #ifndef LK201
  77.       case XK_Select:
  78.           return("4");
  79.       case XK_Prior:
  80. ***************
  81. *** 1206,1211
  82.           return("5");
  83.       case XK_Next:
  84.           return("6");
  85.       default:
  86.           return("-1");
  87.       }
  88.  
  89. --- 1207,1214 -----
  90.           return("5");
  91.       case XK_Next:
  92.           return("6");
  93. + #endif    /* not LK201 */
  94.       default:
  95.           return("-1");
  96.       }
  97. ***************
  98. *** 1210,1215
  99.           return("-1");
  100.       }
  101.   }
  102.   #endif /* not sun */
  103.       
  104.   internal_socket_read(bufp, numchars)
  105.  
  106. --- 1213,1321 -----
  107.           return("-1");
  108.       }
  109.   }
  110. + #ifdef LK201
  111. + char *stringFuncVal_Shifted(keycode)    /* LK201 Function keys - shifted */
  112. +     KeySym keycode;
  113. + {
  114. +     switch (keycode) {
  115. +     case XK_F1:
  116. +         return("41");
  117. +     case XK_F2:
  118. +         return("42");
  119. +     case XK_F3:
  120. +         return("43");
  121. +     case XK_F4:
  122. +         return("44");
  123. +     case XK_F5:
  124. +         return("45");
  125. +     case XK_F6:
  126. +         return("47");
  127. +     case XK_F7:
  128. +         return("48");
  129. +     case XK_F8:
  130. +         return("49");
  131. +     case XK_F9:
  132. +         return("50");
  133. +     case XK_F10:
  134. +         return("51");
  135. +     case XK_F11:
  136. +         return("53");
  137. +     case XK_F12:
  138. +         return("54");
  139. +     case XK_F13:
  140. +         return("55");
  141. +     case XK_F14:
  142. +         return("56");
  143. +     case XK_F15:
  144. +         return("58");
  145. +     case XK_Help:
  146. +         return("58");
  147. +     case XK_F16:
  148. +         return("59");
  149. +     case XK_Menu:
  150. +         return("59");
  151. +     case XK_F17:
  152. +         return("61");
  153. +     case XK_F18:
  154. +         return("62");
  155. +     case XK_F19:
  156. +         return("63");
  157. +     case XK_F20:
  158. +         return("64");
  159. +     default:
  160. +         return("-1");
  161. +     }
  162. + }
  163. + char *stringFuncVal_KP(keycode)    /* LK201 keypad keys */
  164. +     KeySym keycode;
  165. + {
  166. +     switch (keycode) {
  167. +     case XK_KP_F1:
  168. +         return("\033OP");
  169. +     case XK_KP_F2:
  170. +         return("\033OQ");
  171. +     case XK_KP_F3:
  172. +         return("\033OR");
  173. +     case XK_KP_F4:
  174. +         return("\033OS");
  175. +     case XK_KP_Subtract:        /* Minus */
  176. +         return("\033Om");
  177. +     case XK_KP_Separator:        /* Comma */
  178. +         return("\033Ol");
  179. +     case XK_KP_Decimal:        /* Period */
  180. +         return("\033On");
  181. +     case XK_KP_Enter:
  182. +         return("\033OM");
  183. +     case XK_KP_0:
  184. +         return("\033Op");
  185. +     case XK_KP_1:
  186. +         return("\033Oq");
  187. +     case XK_KP_2:
  188. +         return("\033Or");
  189. +     case XK_KP_3:
  190. +         return("\033Os");
  191. +     case XK_KP_4:
  192. +         return("\033Ot");
  193. +     case XK_KP_5:
  194. +         return("\033Ou");
  195. +     case XK_KP_6:
  196. +         return("\033Ov");
  197. +     case XK_KP_7:
  198. +         return("\033Ow");
  199. +     case XK_KP_8:
  200. +         return("\033Ox");
  201. +     case XK_KP_9:
  202. +         return("\033Oy");
  203. +     default:
  204. +         return("-1");
  205. +     }
  206. + }
  207. + #endif    /* LK201 */
  208.   #endif /* not sun */
  209.       
  210.   internal_socket_read(bufp, numchars)
  211. ***************
  212. *** 1336,1341
  213.         if (IsFunctionKey(keysym) ||
  214.         IsMiscFunctionKey(keysym)) {
  215.       strcpy(mapping_buf,"[");
  216.       strcat(mapping_buf,stringFuncVal(keysym));
  217.   #ifdef sun
  218.       strcat(mapping_buf,"z");
  219.  
  220. --- 1442,1452 -----
  221.         if (IsFunctionKey(keysym) ||
  222.         IsMiscFunctionKey(keysym)) {
  223.       strcpy(mapping_buf,"[");
  224. + #ifdef LK201
  225. +     if (event.xkey.state & ShiftMask)
  226. +       strcat(mapping_buf,stringFuncVal_Shifted(keysym));
  227. +     else
  228. + #endif
  229.       strcat(mapping_buf,stringFuncVal(keysym));
  230.   #ifdef sun
  231.       strcat(mapping_buf,"z");
  232. ***************
  233. *** 1344,1349
  234.   #endif /* sun */
  235.       nbytes = strlen(mapping_buf);
  236.         }
  237.         else {
  238.       switch (keysym) {
  239.       case XK_Left:
  240.  
  241. --- 1455,1467 -----
  242.   #endif /* sun */
  243.       nbytes = strlen(mapping_buf);
  244.         }
  245. + #ifdef LK201
  246. +       else
  247. +       if (IsKeypadKey(keysym) || IsPFKey(keysym)) {
  248. +     strcpy(mapping_buf,stringFuncVal_KP(keysym));
  249. +     nbytes = strlen(mapping_buf);
  250. +       }
  251. + #endif
  252.         else {
  253.       switch (keysym) {
  254.       case XK_Left:
  255. ***************
  256. *** 1362,1367
  257.         strcpy(mapping_buf,"\016");
  258.         nbytes = 1;
  259.         break;
  260.       }
  261.         }
  262.         if (nbytes) {
  263.  
  264. --- 1480,1499 -----
  265.         strcpy(mapping_buf,"\016");
  266.         nbytes = 1;
  267.         break;
  268. + #ifdef LK201
  269. +     case XK_Next:
  270. +       strcpy(mapping_buf,"\033[6~");
  271. +       nbytes = 4;
  272. +       break;
  273. +     case XK_Prior:
  274. +       strcpy(mapping_buf,"\033[5~");
  275. +       nbytes = 4;
  276. +       break;
  277. +     case DXK_Remove:
  278. +       strcpy(mapping_buf,"\033[3~");
  279. +       nbytes = 4;
  280. +       break;
  281. + #endif    /* LK201 */
  282.       }
  283.         }
  284.         if (nbytes) {
  285. @EOF
  286.  
  287. chmod 644 x11term.c.LK201.diffs
  288.  
  289. exit 0
  290. -- 
  291. Johan Vromans                       jv@mh.nl via internet backbones
  292. Multihouse Automatisering bv               uucp: ..!{mcvax,hp4nl}!mh.nl!jv
  293. Doesburgweg 7, 2803 PL Gouda, The Netherlands  phone/fax: +31 1820 62944/62500
  294. ------------------------ "Arms are made for hugging" -------------------------
  295.