home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Professional / OS2PRO194.ISO / os2 / prgramer / unix / emacs / lisp / em-keys.elc < prev    next >
Encoding:
Text File  |  1993-06-14  |  10.3 KB  |  280 lines

  1.  
  2. (provide (quote em-keys))
  3.  
  4. (defvar ext-map nil "\
  5. Keymap used for extended scan codes.")
  6.  
  7. (setq ext-map (make-keymap))
  8.  
  9. (defvar em-map nil "\
  10. Keymap used for em's key definitions which are prefixed by F9.")
  11.  
  12. (setq em-map (make-sparse-keymap))
  13.  
  14. (define-key ext-map " " (quote em-dup-line))
  15.  
  16. (define-key ext-map "!" (quote find-file))
  17.  
  18. (define-key ext-map "\"" (quote goto-line))
  19.  
  20. (define-key ext-map "." (quote em-copy-region))
  21.  
  22. (define-key ext-map "&" (quote em-copy-line-as-kill))
  23.  
  24. (define-key ext-map "2" (quote em-match-paren))
  25.  
  26. (define-key ext-map "" (quote open-rectangle))
  27.  
  28. (define-key ext-map "" (quote em-kill-word))
  29.  
  30. (define-key ext-map "" (quote undo))
  31.  
  32. (define-key ext-map "<" (quote em-switch-to-nth-buffer))
  33.  
  34. (define-key ext-map "=" (quote em-search-forward))
  35.  
  36. (define-key ext-map ">" (quote em-search-backward))
  37.  
  38. (define-key ext-map "?" (quote em-fill-paragraph))
  39.  
  40. (define-key ext-map "@" (quote other-window))
  41.  
  42. (define-key ext-map "A" (quote undefined))
  43.  
  44. (define-key ext-map "B" (quote undefined))
  45.  
  46. (define-key ext-map "C" em-map)
  47.  
  48. (define-key ext-map "D" (quote undefined))
  49.  
  50. (define-key ext-map "E" (quote undefined))
  51.  
  52. (define-key ext-map "F" (quote undefined))
  53.  
  54. (define-key ext-map "G" (quote beginning-of-line))
  55.  
  56. (define-key ext-map "H" (quote previous-line))
  57.  
  58. (define-key ext-map "I" (quote scroll-down))
  59.  
  60. (define-key ext-map "J" (quote undefined))
  61.  
  62. (define-key ext-map "K" (quote backward-char))
  63.  
  64. (define-key ext-map "L" (quote goto-line))
  65.  
  66. (define-key ext-map "M" (quote forward-char))
  67.  
  68. (define-key ext-map "N" (quote undefined))
  69.  
  70. (define-key ext-map "O" (quote end-of-line))
  71.  
  72. (define-key ext-map "P" (quote next-line))
  73.  
  74. (define-key ext-map "Q" (quote scroll-up))
  75.  
  76. (define-key ext-map "R" (quote overwrite-mode))
  77.  
  78. (define-key ext-map "S" (quote delete-char))
  79.  
  80. (define-key ext-map "T" (quote describe-key))
  81.  
  82. (define-key ext-map "U" (quote em-buffer-list))
  83.  
  84. (define-key ext-map "V" (quote next-error))
  85.  
  86. (define-key ext-map "W" (quote undefined))
  87.  
  88. (define-key ext-map "X" (quote undefined))
  89.  
  90. (define-key ext-map "Y" (quote undefined))
  91.  
  92. (define-key ext-map "Z" (quote undefined))
  93.  
  94. (define-key ext-map "_" (quote em-find-file-at-point))
  95.  
  96. (define-key ext-map "s" (quote em-backward-to-word))
  97.  
  98. (define-key ext-map "t" (quote em-forward-to-word))
  99.  
  100. (define-key ext-map "u" (quote kill-line))
  101.  
  102. (define-key ext-map "v" (quote em-end-of-buffer))
  103.  
  104. (define-key ext-map "w" (quote em-kill-left-line))
  105.  
  106. (define-key ext-map "Ç" (quote undefined))
  107.  
  108. (define-key ext-map "ä" (quote em-beginning-of-buffer))
  109.  
  110. (define-key ext-map "à" (quote call-last-kbd-macro))
  111.  
  112. (define-key ext-map "å" (quote set-mark-command))
  113.  
  114. (define-key ext-map "ç" (quote expand-abbrev))
  115.  
  116. (define-key ext-map "ì" (quote em-scroll-line-down))
  117.  
  118. (define-key ext-map "Ä" (quote undefined))
  119.  
  120. (define-key ext-map "Å" (quote undefined))
  121.  
  122. (define-key ext-map "É" (quote undefined))
  123.  
  124. (define-key ext-map "æ" (quote em-scroll-line-up))
  125.  
  126. (define-key ext-map "Æ" (quote undefined))
  127.  
  128. (define-key ext-map "Ö" (quote undefined))
  129.  
  130. (define-key ext-map "¢" (quote scroll-right))
  131.  
  132. (define-key ext-map "¥" (quote scroll-left))
  133.  
  134. (define-key ext-map "í" (quote scroll-other-window))
  135.  
  136. (define-key ext-map "Ñ" (quote undefined))
  137.  
  138. (define-key em-map "c" (quote compile))
  139.  
  140. (define-key em-map "i" (quote em-reinitialize))
  141.  
  142. (define-key em-map "j" (quote just-one-space))
  143.  
  144. (define-key em-map "v" (quote em-buffer-file-name))
  145.  
  146. (global-set-key " " (quote set-mark-command))
  147.  
  148. (global-set-key "" ext-map)
  149.  
  150. (define-key ctl-x-map "" (make-sparse-keymap))
  151.  
  152. (define-key ctl-x-4-map "" (make-sparse-keymap))
  153.  
  154. (define-key esc-map "" (make-sparse-keymap))
  155.  
  156. (define-key mode-specific-map "" (make-sparse-keymap))
  157.  
  158. (define-key help-map "" (make-sparse-keymap))
  159.  
  160. (define-key em-map "" (make-sparse-keymap))
  161.  
  162. (defun em-forward-to-word (arg) "\
  163. Move forward until encountering the beginning of a word.
  164. With argument, do this that many times." (interactive "p") (byte-code "└ê├─└┴
  165. $ådbç" [nil t arg re-search-forward "\\W\\b"] 5))
  166.  
  167. (defun em-backward-to-word (arg) "\
  168. Move backward until encountering the beginning of a word.
  169. With argument, do this that many times." (interactive "p") (byte-code "└ê├ ê─┼└┴
  170. $â╞╟!béebç" [nil t arg backward-char re-search-backward "\\W\\b" match-end 0] 6))
  171.  
  172. (defun em-kill-left-line nil "\
  173. Kill from the beginning of the line to point." (interactive "*") (byte-code "└ê┴┬!ç" [nil kill-line 0] 2))
  174.  
  175. (defun em-end-of-buffer nil "\
  176. Move to end of the buffer without setting mark." (interactive) (byte-code "└êdbç" [nil] 1))
  177.  
  178. (defun em-beginning-of-buffer nil "\
  179. Move to the beginning of the buffer without setting mark." (interactive) (byte-code "└êebç" [nil] 1))
  180.  
  181. (defun em-reinitialize nil "\
  182. Load \"~/.emacs, em-keys.el and em-misc.el\".
  183. This is used to load new versions of these files while debugging." (interactive) (byte-code "┴ê┬├!ê┬─!ê┬┼└\"ç" [t nil load "~/.emacs" "em-keys" "em-misc"] 5))
  184.  
  185. (defun em-scroll-line-up (arg) "\
  186. Scroll up by one line.
  187. With argument, do this that many times." (interactive "p") (byte-code "┴ê┬!ç" [arg nil scroll-up] 2))
  188.  
  189. (defun em-scroll-line-down (arg) "\
  190. Scroll down by one line.
  191. With argument, do this that many times." (interactive "p") (byte-code "┴ê┬!ç" [arg nil scroll-down] 2))
  192.  
  193. (defun em-buffer-file-name nil "\
  194. Display the name of the file visited in current buffer." (interactive) (byte-code "┬ê├─å    ┼\"ç" [buffer-file-name t nil message "%s" "Not visiting a file"] 3))
  195.  
  196. (defun em-copy-line-as-kill (arg) "\
  197. Copy line as kill.
  198. With argument, copy that many lines." (interactive "p") (byte-code "├ê`─ ê`┼
  199. !ê╞    `\")êb)ç" [s b arg nil beginning-of-line forward-line copy-region-as-kill] 5))
  200.  
  201. (defun em-dup-line (arg) "\
  202. Duplicate current line.
  203. Set mark to the beginning of the new line.
  204. With argument, do this that many times." (interactive "*p") (byte-code "─ê┼ëê`╞ ê`╟ êh╚=?à╚cê╔
  205. `\"ê ╩Và0╦ ê Sëêéê    b))ç" [last-command s b arg nil identity beginning-of-line forward-line 10 copy-region-as-kill 0 yank] 7))
  206.  
  207. (defun em-kill-word (arg) "\
  208. Delete characters until encountering the beginning of a word.
  209. With argument, do this that many times." (interactive "*p") (byte-code "┬ê`├    !ê─`\")ç" [b arg nil em-forward-to-word kill-region] 4))
  210.  
  211. (defvar em-search-string nil "\
  212. Search string for em-search-forward and em-search-backward.")
  213.  
  214. (defvar em-search-re nil "\
  215. Non-nil means use regular expression for em-search-forward and -backward.")
  216.  
  217. (defun em-search-forward (&optional arg) "\
  218. Search forward for a string.
  219. If prefixed by \\[universal-argument], ask for search string.
  220. If prefixed by \\[universal-argument] \\[universal-argument], use regular expression." (interactive "P") (byte-code "┴ê┬├─#ç" [arg nil em-search-fb search-forward re-search-forward] 4))
  221.  
  222. (defun em-search-backward (&optional arg) "\
  223. Search backward for a string.
  224. If prefixed by \\[universal-argument], ask for search string.
  225. If prefixed by \\[universal-argument] \\[universal-argument], use
  226. regular expression." (interactive "P") (byte-code "┴ê┬├─#ç" [arg nil em-search-fb search-backward re-search-backward] 4))
  227.  
  228. (defun em-search-fb (arg fun re-fun) "\
  229. Search forward or backward for a string.
  230. If the first argument is nil, ask for the string.
  231. The second argument is search-forward or search-backward.
  232. The third argument is re-search-forward or re-search-backward." (byte-code "å    ?à*<à┼@!à@╞Yëê╟
  233. â%╚é&╔    \"ëê╩
  234. â4 é5     \"ç" [arg em-search-string em-search-re re-fun fun numberp 16 read-from-minibuffer "Re-Search forward: " "Search forward: " funcall] 5))
  235.  
  236. (defun em-switch-to-nth-buffer (arg) "\
  237. Switch to the ARG'th buffer.
  238. If a numeric prefix argument is not given, the next buffer is
  239. selected. When using this function successively, the top ARG+1 buffers
  240. are rotated." (interactive "p") (byte-code "╚ê╔ G╩╚╚╞╩Yà
  241.     WààR
  242. 8ëê╦ !ëê╠═ !╬\"àI╧!âC╚ëéISëê
  243. TëêéêàZ╨╤!ê╥ !.ç" [bufs len idx buffer name more t arg nil buffer-list 0 buffer-name /= string-to-char 32 zerop error "Invalid buffer number" switch-to-buffer] 8))
  244.  
  245. (defun em-match-paren (arg) "\
  246. Go to the matching parenthesis if on parenthesis.
  247. This function uses the syntax table." (interactive "p") (byte-code "└ê┴┬!â├─!ê┼─!é┴╞!à╟─!ê╚─!ç" [nil looking-at "\\s(" forward-list 1 backward-char "\\s)" forward-char backward-list] 7))
  248.  
  249. (defun em-buffer-list nil "\
  250. Display a list of names of existing buffers.
  251. Inserts it in buffer *Buffer List* and selects that.
  252. Note that buffers with names starting with spaces are omitted." (interactive) (byte-code "└ê┴ ê┬├─!!ê┴ ç" [nil list-buffers select-window get-buffer-window "*Buffer List*"] 5))
  253.  
  254. (defun em-copy-region nil "\
  255. Copy region to point." (interactive) (byte-code "└ê┴`┬ \"ê├ ç" [nil copy-region-as-kill mark yank] 4))
  256.  
  257. (defun em-fill-paragraph (arg) "\
  258. Fill paragraph at or before point using em's notion of a paragraph.
  259. Prefix arg means justify as well.
  260. Paragraphs are separated by blank lines. The indentation of the first line
  261. is used for indenting the entire paragraph. If there are two consecutive
  262. blanks in the first line of the paragraphs, everything to the left of these
  263. blanks is left as-is and the paragraph is indented to the first non-blank
  264. character after the first two consecutive blanks of the first line." (interactive "P") (byte-code "┼êè┼┼┼┼┼╟╚!à╔╩!êéê╦╚e╠#ê╟╚!à)═ ê`ëê╬╚d╠#ênå;╧╨!ê╤ ëê    bê╟╥!â┐╬╙!êiëê╘ ê`ëê╔╨!ê`ëê═ !ê╒ !âo┼és╓ ╫\"ëê╒╔╨!!àâ`╪
  265. !Wà¼┘╠!êi Vâ£┌█` i[#`\"é¿i Wà¿▄╫ iZ\"êévê▌    ╪
  266. !#ê┌      \\\"é╟▌`╪
  267. !#-)ç" [fill-prefix start end join column nil arg looking-at "^$" forward-line -1 re-search-backward 0 forward-char re-search-forward newline 1 point-marker "^ *[^ 
  268. ]*  " "^ *[^ 
  269. ]*   *" split-line zerop make-string 32 marker-position backward-to-indentation delete-region + insert-char fill-region-as-paragraph] 30))
  270.  
  271. (defun em-extract-file-name (at-point) "\
  272. Return the file name around or before point.
  273. If AT-POINT is not nil, the file names starts at point, that is, characters
  274. before point are ignored." (byte-code "──è
  275. â`ëé\\┼╞!à╟╚e╔#êoâ%eëé\\╟╩e╔#ê┼╦!à3o?âN`Sbê┼╠!âF`ëéK═`\\ëé\\oâX`ëé\\`Tëêbê┼╬!àk╧╔!ëêà~    à~    Và~╨    \")*ç" [start end at-point t nil looking-at "[][- ()<>\\\"|;=*?]" re-search-backward "[^][- :()<>\\\"|;=*?]" 0 "[][- :()<>\\\"|;=*?]" ":" "[A-Za-z]:" 2 "\\([A-Za-z]:\\|\\)[^][- :()<>\\\"|;=*?]*" match-end buffer-substring] 10))
  276.  
  277. (defun em-find-file-at-point (arg) "\
  278. Find file whose name is around or before point.
  279. With prefix argument find file whose name starts at point." (interactive "P") (byte-code "┴ê┬├!!ç" [arg nil find-file em-extract-file-name] 3))
  280.