home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / languages / elisp / misc / wordstar.el < prev    next >
Encoding:
Text File  |  1990-03-21  |  5.8 KB  |  149 lines

  1. ;From jimf%saber@harvard.harvard.edu Wed Jan 31 21:16:36 1990
  2. ;Date: Wed, 31 Jan 90 19:36:26 EST
  3. ;From: jimf%saber@harvard.harvard.edu (Jim Frost)
  4. ;To: dsill@relay
  5. ;Subject: Emacs Lisp archives
  6. ;
  7. ;Someone suggested to me that I submit my wordstar.el emacs lisp file
  8. ;to the elisp archives.  It looks like you're the target point for the
  9. ;archive.
  10. ;
  11. ;If this isn't the case, I'm sorry to bother you -- please just bounce
  12. ;this and tell me you're not the right person.  Otherwise, read on.
  13. ;
  14. ;What follows is a set of Emacs bindings that give a fair approximation
  15. ;of the WordStar 3.x key bindings, with a couple of extensions.  It's
  16. ;good enough not to drive WordStar people crazy but I confess that I
  17. ;didn't work too hard on it (it shows -- nowadays I'd probably make it
  18. ;a mode or something).  If you want to include this in the archives, go
  19. ;ahead -- I just give it away to anyone who requests it anyway.
  20. ;
  21. ;Happy hacking,
  22. ;
  23. ;jim frost
  24. ;saber software
  25. ;jimf@saber.com
  26. ;
  27. ;-- cut here --
  28. ; Wordstar Keycap Definition for EMACS
  29. ;
  30. ; This file causes EMACS to emulate WordStar.  You should do one of
  31. ; two things to make this work.  Either copy this file into ~/.emacs,
  32. ; after which it will be loaded every time you call up emacs, or
  33. ; copy it into ~/.wordstar and make an alias ws 'emacs -l ~/.wordstar'
  34. ; which will let you call it up with the "normal" ws command.
  35. ;
  36. ; caveats: * ^G (delete-character) is hard bound to the emacs function
  37. ;            quit, so if you delete very fast you might cause emacs to
  38. ;            abort.  tell it to save your file and then to continue and
  39. ;            all will be well, although annoying.  this doesn't happen
  40. ;            often unless the machine is kind of slow.
  41. ;          * block copy and delete work as they do in emacs, not in
  42. ;            wordstar, which means you can block end above the block
  43. ;            begin and you can also block-delete from block begin to
  44. ;            where the cursor is without explicitly doing a block-end.
  45. ;          * ^Owv is split-window-vertically
  46. ;          * ^Owh is split-window-horizontally
  47. ;          * ^Owo is other-window
  48. ;          * ^Owd is delete-other-windows
  49. ;
  50. ; for further information contact jim frost at madd@bu-it.bu.edu
  51. ;
  52.  
  53. (setq inhibit-terminal-defaults t)
  54. (setq C-K-map (make-keymap))
  55. (define-key C-K-map " " ())
  56. (define-key C-K-map "b" 'set-mark-command)
  57. (define-key C-K-map "\002" 'set-mark-command)
  58. (define-key C-K-map "c" 'yank)
  59. (define-key C-K-map "\003" 'yank)
  60. (define-key C-K-map "d" 'save-buffers-kill-emacs)
  61. (define-key C-K-map "\004" 'save-buffers-kill-emacs)
  62. (define-key C-K-map "f" 'find-file)
  63. (define-key C-K-map "\006" 'find-file)
  64. (define-key C-K-map "k" 'copy-region-as-kill)
  65. (define-key C-K-map "\013" 'copy-region-as-kill)
  66. (define-key C-K-map "q" 'kill-emacs)
  67. (define-key C-K-map "\021" 'kill-emacs)
  68. (define-key C-K-map "r" 'insert-file)
  69. (define-key C-K-map "\022" 'insert-file)
  70. (define-key C-K-map "s" 'save-some-buffers)
  71. (define-key C-K-map "\023" 'save-some-buffers)
  72. (define-key C-K-map "\025" ())
  73. (define-key C-K-map "v" 'yank)
  74. (define-key C-K-map "\026" 'yank)
  75. (define-key C-K-map "y" 'kill-region)
  76. (define-key C-K-map "\031" 'kill-region)
  77. (define-key C-K-map "\037" 'kill-emacs)
  78.  
  79. (setq C-O-map (make-keymap))
  80. (define-key C-O-map " " ())
  81. (define-key C-O-map "c" 'center-line)
  82. (define-key C-O-map "\003" 'center-line)
  83. (define-key C-O-map "b" 'switch-to-buffer)
  84. (define-key C-O-map "\002" 'switch-to-buffer)
  85. (define-key C-O-map "j" 'justify-current-line)
  86. (define-key C-O-map "\012" 'justify-current-line)
  87. (define-key C-O-map "k" 'kill-buffer)
  88. (define-key C-O-map "\013" 'kill-buffer)
  89. (define-key C-O-map "l" 'list-buffers)
  90. (define-key C-O-map "\014" 'list-buffers)
  91. (define-key C-O-map "m" 'auto-fill-mode)
  92. (define-key C-O-map "\015" 'auto-fill-mode)
  93. (define-key C-O-map "r" 'set-fill-column)
  94. (define-key C-O-map "\022" 'set-fill-column)
  95. (define-key C-O-map "\025" ())
  96. (define-key C-O-map "wd" 'delete-other-windows)
  97. (define-key C-O-map "wh" 'split-window-horizontally)
  98. (define-key C-O-map "wo" 'other-window)
  99. (define-key C-O-map "wv" 'split-window-vertically)
  100.  
  101. (setq C-Q-map (make-keymap))
  102. (define-key C-Q-map " " ())
  103. (define-key C-Q-map "a" 'replace-string)
  104. (define-key C-Q-map "\001" 'replace-string)
  105. (define-key C-Q-map "c" 'end-of-buffer)
  106. (define-key C-Q-map "\003" 'end-of-buffer)
  107. (define-key C-Q-map "d" 'end-of-line)
  108. (define-key C-Q-map "\004" 'end-of-line)
  109. (define-key C-Q-map "f" 're-search-forward)
  110. (define-key C-Q-map "\006" 're-search-forward)
  111. (define-key C-Q-map "r" 'beginning-of-buffer)
  112. (define-key C-Q-map "\022" 'beginning-of-buffer)
  113. (define-key C-Q-map "\025" ())
  114. (define-key C-Q-map "y" 'kill-line)
  115. (define-key C-Q-map "\031" 'kill-line)
  116.  
  117. (define-key global-map "\001" 'backward-word)
  118. (define-key global-map "\002" 'fill-paragraph)
  119. (define-key global-map "\003" 'scroll-up)
  120. (define-key global-map "\004" 'forward-char)
  121. (define-key global-map "\005" 'previous-line)
  122. (define-key global-map "\006" 'forward-word)
  123. (define-key global-map "\007" 'delete-char)
  124. (define-key global-map "\010" 'backward-char)
  125. (define-key global-map "\011" 'indent-for-tab-command)
  126. (define-key global-map "\012" 'help-for-help)
  127. (define-key global-map "\013" C-K-map)
  128. (define-key global-map "\015" 'newline)
  129. (define-key global-map "\017" C-O-map)
  130. (define-key global-map "\020" 'quoted-insert)
  131. (define-key global-map "\021" C-Q-map)
  132. (define-key global-map "\022" 'scroll-down)
  133. (define-key global-map "\023" 'backward-char)
  134. (define-key global-map "\024" 'kill-word)
  135. (define-key global-map "\025" 'quit)
  136. (define-key global-map "\026" 'overwrite-mode)
  137. (define-key global-map "\030" 'next-line)
  138. (define-key global-map "\031" '(lambda () (interactive)
  139.                 (beginning-of-line)
  140.                 (delete-region (point)
  141.                            (progn (forward-line 1)
  142.                               (point)))))
  143. (define-key global-map "\035" 'quoted-insert)
  144. (define-key global-map "\037" C-Q-map)
  145.  
  146. (setq default-fill-column 65)
  147.  
  148.  
  149.