home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / languages / elisp / functions / dvorak-map.el < prev    next >
Encoding:
Text File  |  1990-07-22  |  5.9 KB  |  167 lines

  1. ;From utkcs2!emory!samsung!cs.utexas.edu!mailrus!ames!bionet!agate!shelby!lindy!drapeau Thu Jun 28 14:50:36 EDT 1990
  2. ;Article 18367 of comp.windows.x:
  3. ;Path: utkcs2!emory!samsung!cs.utexas.edu!mailrus!ames!bionet!agate!shelby!lindy!drapeau
  4. ;>From: drapeau@sioux.Stanford.EDU (George Drapeau)
  5. ;Newsgroups: comp.windows.x
  6. ;Subject: Re: Dvorak keyboard layout for Xmodmap
  7. ;Message-ID: <DRAPEAU.90Jun27231718@sioux.Stanford.EDU>
  8. ;Date: 28 Jun 90 06:17:18 GMT
  9. ;References: <3930013@hpclsv.HP.COM>
  10. ;Sender: root@lindy.Stanford.EDU (Rooter)
  11. ;Organization: Interactive Classroom Experiment, Stanford University
  12. ;Lines: 163
  13. ;In-reply-to: sundarv@hpclsv.HP.COM's message of 22 Jun 90 18:18:29 GMT
  14. ;
  15. ;In article <3930013@hpclsv.HP.COM> sundarv@hpclsv.HP.COM (Sundar Varadarajan) writes:
  16. ;
  17. ;   Does someone have a file that I can feed to xmodmap to get the dvorak
  18. ;   keyboard layout on my qwerty keyboard?
  19. ;
  20. ;When I learned the Dvorak layout, I wanted to be able to switch back
  21. ;and forth on an application-by application basis, so that I could have
  22. ;one xterm with a "talk" session going on in Qwerty (which was still
  23. ;more comfortable to me) and another xterm session with the Dvorak
  24. ;typing tutor program.  This solution is not solvable through xmodmap
  25. ;(although I think that xmodmap is a cool idea).
  26. ;
  27. ;So, I wrote a translation table.  In my opinion, just that I was able
  28. ;to remap my keyboard at the touch of a button from within xterm is
  29. ;proof that the translation tables are an excellent mechanism (Thanks,
  30. ;X-people).
  31. ;
  32. ;Here are two versions, neither of which are completely correct but are
  33. ;certainly good enough for typing.  Specifically what's not correct is
  34. ;that control keys retain their normal bindings; in other words, while
  35. ;typing "g" produces an "i", typing Control-g still produces Control-g.
  36. ;I did this because I tend to use control characters by feel rather
  37. ;than by thinking "Press Control-g".  To fully convert to Dvorak, I
  38. ;suppose that the Control sequences should also be rebound.
  39. ;
  40. ;The two bindings are for XTerm and for Emacs.  Load the first file
  41. ;into the X Resource Database, and maybe put the second file inte your
  42. ;~/.emacs file.
  43. ;
  44. ;To switch to Dvorak in xterm, press your "F1" key; to switch back to
  45. ;Qwerty, press your "F2" key.
  46. ;
  47. ;In Emacs, to switch to Dvorak, type "M-x Dvorak" (case is important,
  48. ;which probably means you can just type "M-x D" then press return).  To
  49. ;switch back to Qwerty, type "M-x Qwerty" ("M-x Q" is probably good
  50. ;enough).  If you don't remember your Dvorak, the Dvorak for the word
  51. ;"Qwerty" is "X,dokt" (in other words, if you're looking at the
  52. ;keyboard when you switch back to Qwerty, type "M-x X,dokt").
  53. ;
  54. ;Okay, enough talk.  I hope this helps you some.
  55. ;
  56. ;    George
  57. ;--------------- Translation table (plus some other Resources) ---------------
  58. ;*VT100.Translations:#override    \
  59. ;<Key>F1:    keymap(Dvorak)    \n\
  60. ;<Key>F2:    keymap(None)
  61. ;
  62. ;
  63. ;*DvorakKeymap.translations:#override\
  64. ;:Ctrl<Key>a:        string(0x01)    \n\
  65. ;:Ctrl<Key>b:        string(0x02)    \n\
  66. ;:Ctrl<Key>c:        string(0x03)    \n\
  67. ;:Ctrl<Key>d:        string(0x04)    \n\
  68. ;:Ctrl<Key>e:        string(0x05)    \n\
  69. ;:Ctrl<Key>f:        string(0x06)    \n\
  70. ;:Ctrl<Key>g:        string(0x07)    \n\
  71. ;:Ctrl<Key>h:        string(0x08)    \n\
  72. ;:Ctrl<Key>i:        string(0x09)    \n\
  73. ;:Ctrl<Key>j:        string(0x0a)    \n\
  74. ;:Ctrl<Key>k:        string(0x0b)    \n\
  75. ;:Ctrl<Key>l:        string(0x0c)    \n\
  76. ;:Ctrl<Key>m:        string(0x0d)    \n\
  77. ;:Ctrl<Key>n:        string(0x0e)    \n\
  78. ;:Ctrl<Key>o:        string(0x0f)    \n\
  79. ;:Ctrl<Key>p:        string(0x10)    \n\
  80. ;:Ctrl<Key>q:        string(0x11)    \n\
  81. ;:Ctrl<Key>r:        string(0x12)    \n\
  82. ;:Ctrl<Key>s:        string(0x13)    \n\
  83. ;:Ctrl<Key>t:        string(0x14)    \n\
  84. ;:Ctrl<Key>u:        string(0x15)    \n\
  85. ;:Ctrl<Key>v:        string(0x16)    \n\
  86. ;:Ctrl<Key>w:        string(0x17)    \n\
  87. ;:Ctrl<Key>x:        string(0x18)    \n\
  88. ;:Ctrl<Key>y:        string(0x19)    \n\
  89. ;:Ctrl<Key>z:        string(0x1a)    \n\
  90. ;:<Key>a:        string(a)    \n\
  91. ;:<Key>b:        string(x)    \n\
  92. ;:<Key>c:        string(j)    \n\
  93. ;:<Key>d:        string(e)    \n\
  94. ;:<Key>e:        string(".")    \n\
  95. ;:<Key>f:        string(u)    \n\
  96. ;:<Key>g:        string(i)    \n\
  97. ;:<Key>h:        string(d)    \n\
  98. ;:<Key>i:        string(c)    \n\
  99. ;:<Key>j:        string(h)    \n\
  100. ;:<Key>k:        string(t)    \n\
  101. ;:<Key>l:        string(n)    \n\
  102. ;:<Key>m:        string(m)    \n\
  103. ;:<Key>n:        string(b)    \n\
  104. ;:<Key>o:        string(r)    \n\
  105. ;:<Key>p:        string(l)    \n\
  106. ;:<Key>q:        string("'")    \n\
  107. ;:<Key>r:        string(p)    \n\
  108. ;:<Key>s:        string(o)    \n\
  109. ;:<Key>t:        string(y)    \n\
  110. ;:<Key>u:        string(g)    \n\
  111. ;:<Key>v:        string(k)    \n\
  112. ;:<Key>w:        string(",")    \n\
  113. ;:<Key>x:        string(q)    \n\
  114. ;:<Key>y:        string(f)    \n\
  115. ;:<Key>z:        string(";")    \n\
  116. ;:<Key>minus:        string("`")    \n\
  117. ;:<Key>semicolon:    string(s)    \n\
  118. ;:<Key>grave:        string("/")    \n\
  119. ;:<Key>apostrophe:    string("-")    \n\
  120. ;:<Key>comma:        string(w)    \n\
  121. ;:<Key>period:        string(v)    \n\
  122. ;:<Key>slash:        string(z)    \n\
  123. ;:<Key>quotedbl:        string("_")    \n\
  124. ;:<Key>underscore:    string("~")    \n\
  125. ;:<Key>asciitilde:    string("?")    \n\
  126. ;:<Key>A:        string(A)    \n\
  127. ;:<Key>B:        string(X)    \n\
  128. ;:<Key>C:        string(J)    \n\
  129. ;:<Key>D:        string(E)    \n\
  130. ;:<Key>E:        string(">")    \n\
  131. ;:<Key>F:        string(U)    \n\
  132. ;:<Key>G:        string(I)    \n\
  133. ;:<Key>H:        string(D)    \n\
  134. ;:<Key>I:        string(C)    \n\
  135. ;:<Key>J:        string(H)    \n\
  136. ;:<Key>K:        string(T)    \n\
  137. ;:<Key>L:        string(N)    \n\
  138. ;:<Key>M:        string(M)    \n\
  139. ;:<Key>N:        string(B)    \n\
  140. ;:<Key>O:        string(R)    \n\
  141. ;:<Key>P:        string(L)    \n\
  142. ;:<Key>Q:        string(0x22)    \n\
  143. ;:<Key>R:        string(P)    \n\
  144. ;:<Key>S:        string(O)    \n\
  145. ;:<Key>T:        string(Y)    \n\
  146. ;:<Key>U:        string(G)    \n\
  147. ;:<Key>V:        string(K)    \n\
  148. ;:<Key>W:        string("<")    \n\
  149. ;:<Key>X:        string(Q)    \n\
  150. ;:<Key>Y:        string(F)    \n\
  151. ;:<Key>Z:        string(":")    \n\
  152. ;:<Key>less:        string(W)    \n\
  153. ;:<Key>greater:        string(V)    \n\
  154. ;:<Key>question:        string(Z)    \n\
  155. ;:<Key>colon:        string(S)
  156. ;
  157. ;
  158. ;---------------------- Put this in your .emacs file ----------------------
  159.  
  160. (defun Dvorak ()
  161.   "Written by George Drapeau, uses a translation table that turns your keyboard
  162. into a Dvorak keyboard.  Try it, you'll like it."
  163.   (interactive)
  164.   (setq keyboard-translate-table "\C-@\C-a\C-b\C-c\C-d\C-e\C-f\C-g\C-h\C-i\C-j\C-k\C-l\C-m\C-n\C-o\C-p\C-q\C-r\C-s\C-t\C-u\C-v\C-w\C-x\C-y\C-z\033\034\035\036\037 !_#$%&-()*+w`vz0123456789SsW=VZ@AXJE>UIDCHTNMBRL\"POYGK<QF:[\\]^~/axje.uidchtnmbrl'po
  165.  
  166.  
  167.