home *** CD-ROM | disk | FTP | other *** search
/ Internet File Formats / InternetFileFormatsCD.bin / text / latex / mac / alpha60.hqx / Tcl / SystemCode / emacs.tcl < prev    next >
Encoding:
Text File  |  1995-07-04  |  2.2 KB  |  118 lines

  1.  
  2. # Emacs-ish bindings.
  3. bind 0x33 <e>      backwardDeleteWord 
  4. bind 'b' <es>    backwardWordSelect 
  5. bind '<' <se>     beginningOfBuffer 
  6. bind 'b' <X>    chooseWindowStatus 
  7. bind 'l' <X>    currentPosition 
  8. bind ')' <Xs>    endKeyboardMacro 
  9. bind '>' <se>     endOfBuffer 
  10. bind 'x' <Xz>    exchangePointAndMark 
  11. bind 'w' <Xz>    saveAs 
  12. bind 'e' <X>    executeKeyboardMacro 
  13. bind 'f' <Xz>    findFile 
  14. bind 'f' <es>     forwardWordSelect 
  15. bind '\ ' <e>    oneSpace 
  16. bind 'c' <z>     prefixChar 
  17. bind 'x' <z>     prefixChar 
  18. bind 'r' <e>     repeatSearchBackward 
  19. bind 's' <e>     repeatSearchForward 
  20. bind 's' <Xz>    save 
  21. bind '(' <sX>    startKeyboardMacro 
  22. bind 'o' <X>    otherThing 
  23. bind '1' <X>    zoom 
  24. bind 'k' <X>    killWindowStatus
  25. bind 'u' <X>    upcaseWord
  26.  
  27.  
  28. proc emacsMenu {} {
  29.     global useEmacs
  30.     if {$useEmacs} {    
  31.         menu -n emacs {
  32.             "/F<BforwardChar"
  33.             "/B<BbackwardChar"
  34.             "/D<BdeleteChar"
  35.             "/N<BnextLine"
  36.             "/P<BpreviousLine"
  37.             "(-"
  38.             "/F<IforwardWord"
  39.             "/B<IbackwardWord"
  40.             "/D<IdeleteWord"
  41.             "/H<IbackwardDeleteWord"
  42.             "(-"
  43.             "/G<IgotoLine"
  44.             "/K<BkillLine"
  45.             "/A<BbeginningOfLine"
  46.             "/E<BendOfLine"
  47.             "/O<BopenLine"
  48.             "(-"
  49.             "/V<BpageForward"
  50.             "/V<IpageBack"
  51.             "/L<BcenterRedraw"
  52.             "(-"
  53.             "/ <BsetMark"
  54.             "/W<Bcut"
  55.             "/W<Icopy"
  56.             "/Y<Byank"
  57.             "(-"
  58.             "/C<IcapitalizeWord"
  59.             "upcaseWord"
  60.             "/L<IdowncaseWord"
  61.             "(-"
  62.             "/X<Iexecute"
  63.             "/U<BiterationCount"
  64.             "/G<BabortEm"
  65.             "(-"
  66.             "disableEmacs"
  67.         }
  68.     } else {
  69.         menu -n emacs { enableEmacs }
  70.     }
  71. }
  72. emacsMenu
  73.  
  74.  
  75. proc disableEmacs {} {
  76.     global useEmacs modifiedVars
  77.     lappend modifiedVars useEmacs
  78.     set useEmacs 0
  79.     emacsMenu
  80. }
  81.  
  82. proc enableEmacs {} {
  83.     global useEmacs modifiedVars
  84.     lappend modifiedVars useEmacs
  85.     set useEmacs 1
  86.     emacsMenu
  87. }
  88.  
  89.  
  90. bind 'f' <e> forwardWord
  91. bind 'b' <e> backwardWord
  92. bind 'd' <e> deleteWord
  93. bind 'h' <e> backwardDeleteWord
  94. bind 'v' <e> pageBack
  95. bind 'w' <e> copy
  96. bind 'g' <e> gotoLine
  97. bind 'e' <e> nextSentence
  98. bind 'a' <e> prevSentence
  99. bind 'c' <e> capitalizeWord
  100. bind 'u' <e> upcaseWord
  101. bind 'l' <e> downcaseWord
  102. bind 'x' <e> execute
  103. bind 0x31  <e> oneSpace
  104. bind 0x31  <o> oneSpace
  105.  
  106.  
  107. proc killRegion {} {
  108.     set from [getMark]
  109.     set to [getPos]
  110.     if {$to < $from} {
  111.         deleteText $to $from
  112.     } else {
  113.         deleteText $from $to
  114.     }
  115. }
  116.  
  117. bind 'd' <X>    killRegion
  118.